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.

104 lines
3.2KB

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