note_management_page.dart 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import 'package:cs_resources/generated/l10n.dart';
  2. import 'package:cs_resources/theme/app_colors_theme.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:auto_route/auto_route.dart';
  5. import 'package:hooks_riverpod/hooks_riverpod.dart';
  6. import 'package:router/ext/auto_router_extensions.dart';
  7. import 'package:widgets/ext/ex_widget.dart';
  8. import 'package:widgets/my_button.dart';
  9. import '../../router/page/form_page_router.dart';
  10. import 'vm/apply_view_model.dart';
  11. @RoutePage()
  12. class NoteManagementPage extends HookConsumerWidget {
  13. const NoteManagementPage({Key? key}) : super(key: key);
  14. //启动当前页面
  15. static void startInstance({BuildContext? context}) {
  16. if (context != null) {
  17. context.router.push(const NoteManagementPageRoute());
  18. } else {
  19. appRouter.push(const NoteManagementPageRoute());
  20. }
  21. }
  22. @override
  23. Widget build(BuildContext context, WidgetRef ref) {
  24. final viewModel = ref.watch(applyViewModelProvider.notifier);
  25. final state = ref.watch(applyViewModelProvider);
  26. return WillPopScope(
  27. child: Scaffold(
  28. appBar: AppBar(title: Text("NoteManagementPage")),
  29. body: Column(
  30. children: [
  31. Text("NoteManagementPage").expanded(),
  32. //底部按钮
  33. MyButton(
  34. onPressed: viewModel.gotoNextPage,
  35. text: S.current.next,
  36. textColor: Colors.white,
  37. backgroundColor: context.appColors.btnBgDefault,
  38. fontWeight: FontWeight.w500,
  39. type: ClickType.throttle,
  40. fontSize: 16,
  41. minHeight: 50,
  42. radius: 0,
  43. ),
  44. ],
  45. )),
  46. onWillPop: () async{
  47. viewModel.handlePopAction();
  48. return true;
  49. });
  50. }
  51. }