import 'package:flui/flui.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// 用户中心页面
class UserSettingPage extends StatefulWidget {
UserSettingPage({Key key}) : super(key: key);
@override
_UserSettingPageState createState() => _UserSettingPageState();
}
class _UserSettingPageState extends State<UserSettingPage> with RouteAware {
// 点击底部退出按钮
willSelectLogout() {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return AlertDialog(
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 40),
),
GestureDetector(
onTap: () {},
child: Text(' 退出登录'),
),
Padding(
padding: EdgeInsets.only(bottom: 20),
),
Padding(
padding: EdgeInsets.only(bottom: 20),
),
GestureDetector(
onTap: () async {
await SystemChannels.platform
.invokeMethod('SystemNavigator.pop');
},
child: Text(' 退出程序'),
),
],
),
),
actions: <Widget>[
FlatButton(
child: Text('取消'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
).then((val) {
print(val);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: FLAppBarTitle(
title: '设置',
// subtitle: '(subtitle)',
),
centerTitle: true,
),
body: ListView(
children: [
FLStaticListView(
shrinkWrap: true,
sections: [
FLStaticSectionData(headerTitle: '账号', itemList: [
FLStaticItemData(
title: '账号管理',
accessoryType: FLStaticListCellAccessoryType.accDetail,
onTap: null),
FLStaticItemData(
title: '账号与安全',
accessoryType: FLStaticListCellAccessoryType.accDetail,
onTap: null),
]),
FLStaticSectionData(headerTitle: '设置', itemList: [
FLStaticItemData(
title: '推送通知设置',
accessoryType: FLStaticListCellAccessoryType.accDetail,
accessoryString: '全部通知',
onTap: () => {}),
FLStaticItemData(
title: '护眼模式',
accessoryType: FLStaticListCellAccessoryType.accSwitch,
accItemValue: true,
onButtonPressed: () {
print('onButtonPressed');
},
onTap: () => {print('onTap')},
),
FLStaticItemData(
title: '自动清理缓存',
subtitle: '每 10 天清理一次',
accessoryType: FLStaticListCellAccessoryType.accCheckmark,
onTap: null,
selected: false,
)
]),
FLStaticSectionData(itemList: [
FLStaticItemData(
cellType: FLStaticListCellType.button,
buttonTitle: '退出登录',
buttonTitleColor: Colors.blue,
onButtonPressed: () {
print('button pressed');
}),
FLStaticItemData(
cellType: FLStaticListCellType.button,
buttonTitle: '退出程序',
buttonTitleColor: Colors.red,
onButtonPressed: () {
willSelectLogout();
})
])
],
)
],
),
);
}
}