import 'package:flutter/material.dart'; import 'package:twong/config/style.dart'; class CatePage extends StatefulWidget { @override State createState() { return _CatePageState(); } } class _CatePageState extends State { int _currentIndex = 0; List _buildTabs () { List list = List(); 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: [ Container( padding: EdgeInsets.only(right: 20), alignment: Alignment.center, child: InkWell( child: Text("返回"), onTap: () { Navigator.pop(context); }, ), ), ], ), ), body: Flex( direction: Axis.horizontal, children: [ 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), ),) ], ), ); } }