You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.1KB

  1. import 'package:farm_tpf/presentation/custom_widgets/app_bar_widget.dart';
  2. import 'package:farm_tpf/presentation/custom_widgets/button_icon_widget.dart';
  3. import 'package:farm_tpf/presentation/screens/profile/sc_update_profile.dart';
  4. import 'package:farm_tpf/utils/const_color.dart';
  5. import 'package:farm_tpf/utils/const_icons.dart';
  6. import 'package:flutter/material.dart';
  7. import 'package:get/get.dart';
  8. import 'package:package_info/package_info.dart';
  9. class AccountScreen extends StatefulWidget {
  10. @override
  11. _AccountScreenState createState() => _AccountScreenState();
  12. }
  13. class _AccountScreenState extends State<AccountScreen> {
  14. PackageInfo _packageInfo = PackageInfo(
  15. version: '1.0.0',
  16. buildNumber: '1.',
  17. );
  18. Future<void> _initPackageInfo() async {
  19. final PackageInfo info = await PackageInfo.fromPlatform();
  20. setState(() {
  21. _packageInfo = info;
  22. });
  23. }
  24. @override
  25. void initState() {
  26. super.initState();
  27. _initPackageInfo();
  28. }
  29. @override
  30. Widget build(BuildContext context) {
  31. return Scaffold(
  32. backgroundColor: Colors.white,
  33. appBar: AppBarWidget(
  34. isBack: false,
  35. ),
  36. body: Column(
  37. crossAxisAlignment: CrossAxisAlignment.start,
  38. children: <Widget>[
  39. Container(
  40. padding: EdgeInsets.all(8),
  41. color: Colors.white,
  42. child: Text(
  43. 'Cá nhân',
  44. style: TextStyle(fontWeight: FontWeight.w500, fontSize: 22),
  45. )),
  46. Expanded(
  47. child: Column(children: [
  48. ButtonIconWidget(
  49. title: 'Tài khoản',
  50. leadingIcon: AppIcons.icUser,
  51. trailingIcon: AppIcons.icArrowRight,
  52. isTopBorder: false,
  53. onTap: () {
  54. Get.to(UpdateProfileScreen());
  55. }),
  56. ButtonIconWidget(
  57. title: 'Bảo mật',
  58. leadingIcon: AppIcons.icSecurity,
  59. trailingIcon: AppIcons.icArrowRight,
  60. isTopBorder: false,
  61. isBottomBorder: false,
  62. onTap: () {}),
  63. Container(
  64. width: double.infinity,
  65. height: 20,
  66. color: Colors.grey[200],
  67. ),
  68. Container(
  69. padding: EdgeInsets.only(left: 12, right: 8, top: 14, bottom: 14),
  70. child: Row(
  71. children: [
  72. Expanded(
  73. child: Text(
  74. 'Phiên bản',
  75. style: TextStyle(fontSize: 16, fontWeight: FontWeight.w100),
  76. )),
  77. Text("${_packageInfo.version}.${_packageInfo.buildNumber}")
  78. ],
  79. ),
  80. ),
  81. ButtonIconWidget(
  82. title: 'Đăng xuất',
  83. titleStyle: TextStyle(
  84. fontSize: 16,
  85. fontWeight: FontWeight.w100,
  86. color: Colors.red),
  87. leadingIcon: AppIcons.icLogout,
  88. trailingIcon: AppIcons.icArrowRight,
  89. onTap: () {}),
  90. ])),
  91. ],
  92. ),
  93. );
  94. }
  95. }