12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import 'package:cpt_profile/modules/setting/setting_view_model.dart';
- import 'package:cpt_profile/router/page/profile_page_router.dart';
- import 'package:cs_resources/generated/l10n.dart';
- import 'package:cs_resources/theme/app_colors_theme.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:auto_route/auto_route.dart';
- import 'package:hooks_riverpod/hooks_riverpod.dart';
- import 'package:plugin_basic/provider/app_config/app_config_service.dart';
- import 'package:router/ext/auto_router_extensions.dart';
- import 'package:widgets/my_appbar.dart';
- import 'package:widgets/my_text_view.dart';
- import 'package:widgets/shatter/setting_item_container.dart';
- @RoutePage()
- class SettingPage extends HookConsumerWidget {
- const SettingPage({Key? key}) : super(key: key);
- //启动当前页面
- static void startInstance({BuildContext? context}) {
- if (context != null) {
- context.router.push(const SettingPageRoute());
- } else {
- appRouter.push(const SettingPageRoute());
- }
- }
- @override
- Widget build(BuildContext context, WidgetRef ref) {
- final viewModel = ref.watch(settingViewModelProvider.notifier);
- final state = ref.watch(settingViewModelProvider);
- return Scaffold(
- appBar: MyAppBar.appBar(context, S.current.settings, backgroundColor: context.appColors.whiteBG),
- backgroundColor: context.appColors.backgroundDark,
- body: SingleChildScrollView(
- scrollDirection: Axis.vertical,
- physics: const BouncingScrollPhysics(),
- child: Column(
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- const SizedBox(height: 10),
- //允许通知
- SettingItemContainer(
- title: S.current.enable_notification,
- rightWidget: CupertinoSwitch(
- activeColor: context.appColors.textPrimary,
- value: state.enbaleNofitication,
- onChanged: (value) {
- viewModel.changeEnableNotification(value);
- },
- ),
- ),
- //修改手机号码
- SettingItemContainer(title: S.current.change_mobile_phone),
- //重置密码
- SettingItemContainer(title: S.current.reset_password),
- //隐私协议
- SettingItemContainer(title: S.current.privacy_policy),
- //服务条款
- SettingItemContainer(title: S.current.terms_conditions),
- //删除账号
- SettingItemContainer(title: S.current.account_deactivation),
- //评价我们
- SettingItemContainer(title: S.current.rate_us),
- //版本号
- SettingItemContainer(
- title: S.current.version_no,
- rightWidget: MyTextView(
- AppConfigService.getState().version,
- textColor: context.appColors.textPrimary,
- fontSize: 15,
- isFontMedium: true,
- ),
- ),
- ],
- ),
- ),
- );
- }
- }
|