setting.dart 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import 'package:flutter/material.dart';
  2. import 'package:twong/router/base.dart';
  3. import 'package:twong/utils/index.dart';
  4. import 'package:twong/config/style.dart';
  5. import 'package:twong/widgets/app_bar.dart';
  6. class SettingPage extends StatefulWidget {
  7. @override
  8. State<StatefulWidget> createState() {
  9. return _SettingPageState();
  10. }
  11. }
  12. class _SettingPageState extends State<SettingPage> {
  13. @override
  14. Widget build(BuildContext context) {
  15. return Scaffold(
  16. appBar: DAppBar("设置"),
  17. body: SafeArea(
  18. child: ListView(
  19. children: [
  20. _buildLogout()
  21. ],
  22. ),
  23. ),
  24. );
  25. }
  26. Widget _buildLogout () {
  27. return Container(
  28. padding: EdgeInsets.all(16),
  29. child: FlatButton(
  30. color: DColors.Main,
  31. shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20))),
  32. onPressed: () {
  33. Utils.showAlert(context, title: "确定退出登陆?", ok: () {
  34. Cache.clearAll();
  35. Navigator.pop(context);
  36. Navigator.popAndPushNamed(context, RouteNames.home);
  37. });
  38. },
  39. child: Text('退出登录', style: TextStyle(color: Colors.white)),
  40. ),
  41. );
  42. }
  43. }