| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import 'package:flutter/material.dart';
- import 'package:twong/config/style.dart';
- class CatePage extends StatefulWidget {
- @override
- State<StatefulWidget> createState() {
- return _CatePageState();
- }
- }
- class _CatePageState extends State<CatePage> {
- int _currentIndex = 0;
- List<Widget> _buildTabs () {
- List<Widget> list = List<Widget>();
- var tabs = ['10元', '20元', '50元', '99元'];
- for(var item in tabs) {
- list.add(ListTile(
- title: Text(item),
- leading: Icon(Icons.cake),
- onTap: () {
- setState(() {
- _currentIndex = tabs.indexOf(item);
- print(_currentIndex);
- });
- })
- );
- }
- return list;
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: PreferredSize(
- preferredSize: DStyle.appBarHeight,
- child: AppBar(
- centerTitle: true,
- title: Text('分类'),
- automaticallyImplyLeading: false,
- backgroundColor: Colors.black,
- actions: <Widget>[
- Container(
- padding: EdgeInsets.only(right: 20),
- alignment: Alignment.center,
- child: InkWell(
- child: Text("返回"),
- onTap: () {
- Navigator.pop(context);
- },
- ),
- ),
- ],
- ),
- ),
- body: Flex(
- direction: Axis.horizontal,
- children: <Widget>[
- Expanded(flex: 1, child: Container(
- decoration: BoxDecoration(
- color: Colors.white,
- boxShadow: [
- BoxShadow(
- offset: Offset(10, 0),
- color: Colors.grey,
- blurRadius: 1.0, //阴影模糊程度
- spreadRadius: 1.0 //阴影扩散程度
- )
- ]
- ),
- child: Column(
- children: _buildTabs()
- )
- ),),
- Expanded(flex: 2, child: Container(
- color: Color.fromRGBO(233, 233, 233, 1),
- ),)
- ],
- ),
- );
- }
- }
|