Showing
4 changed files
with
134 additions
and
5 deletions
| ... | @@ -68,8 +68,11 @@ class _HomeState extends State<Home> with RestorationMixin { | ... | @@ -68,8 +68,11 @@ class _HomeState extends State<Home> with RestorationMixin { |
| 68 | children: <Widget>[ | 68 | children: <Widget>[ |
| 69 | InkWell( | 69 | InkWell( |
| 70 | onTap: () { | 70 | onTap: () { |
| 71 | - _pageController.animateToPage(0, | 71 | + _pageController.animateToPage( |
| 72 | - duration: const Duration(milliseconds: 100), curve: Curves.easeOutSine); | 72 | + 0, |
| 73 | + duration: const Duration(milliseconds: 100), | ||
| 74 | + curve: Curves.easeOutSine, | ||
| 75 | + ); | ||
| 73 | }, | 76 | }, |
| 74 | child: Container( | 77 | child: Container( |
| 75 | alignment: Alignment.center, | 78 | alignment: Alignment.center, |
| ... | @@ -86,8 +89,11 @@ class _HomeState extends State<Home> with RestorationMixin { | ... | @@ -86,8 +89,11 @@ class _HomeState extends State<Home> with RestorationMixin { |
| 86 | ), | 89 | ), |
| 87 | InkWell( | 90 | InkWell( |
| 88 | onTap: () { | 91 | onTap: () { |
| 89 | - _pageController.animateToPage(1, | 92 | + _pageController.animateToPage( |
| 90 | - duration: const Duration(milliseconds: 100), curve: Curves.easeOutSine); | 93 | + 1, |
| 94 | + duration: const Duration(milliseconds: 100), | ||
| 95 | + curve: Curves.easeOutSine, | ||
| 96 | + ); | ||
| 91 | }, | 97 | }, |
| 92 | child: Container( | 98 | child: Container( |
| 93 | alignment: Alignment.center, | 99 | alignment: Alignment.center, | ... | ... |
lib/poem/page/poem_complete_page.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:one_poem/res/resources.dart'; | ||
| 3 | +import 'package:one_poem/routers/fluro_navigator.dart'; | ||
| 4 | +import 'package:one_poem/routers/routers.dart'; | ||
| 5 | +import 'package:one_poem/util/toast_utils.dart'; | ||
| 6 | +import 'package:one_poem/widgets/my_app_bar.dart'; | ||
| 7 | + | ||
| 8 | +import 'package:one_poem/extension/int_extension.dart'; | ||
| 9 | + | ||
| 10 | +class PoemCompletePage extends StatefulWidget { | ||
| 11 | + const PoemCompletePage({Key? key, required this.data}) : super(key: key); | ||
| 12 | + | ||
| 13 | + final String data; | ||
| 14 | + @override | ||
| 15 | + _PoemCompletePageState createState() => _PoemCompletePageState(); | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +class _PoemCompletePageState extends State<PoemCompletePage> { | ||
| 19 | + @override | ||
| 20 | + void initState() { | ||
| 21 | + super.initState(); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + @override | ||
| 25 | + void dispose() { | ||
| 26 | + super.dispose(); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + @override | ||
| 30 | + Widget build(BuildContext context) { | ||
| 31 | + return WillPopScope( | ||
| 32 | + onWillPop: _isExit, | ||
| 33 | + child: Scaffold( | ||
| 34 | + appBar: const MyAppBar( | ||
| 35 | + isBack: false, | ||
| 36 | + isTransparent: true, | ||
| 37 | + ), | ||
| 38 | + body: Column( | ||
| 39 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 40 | + children: <Widget>[ | ||
| 41 | + Gaps.vGap24, | ||
| 42 | + Container( | ||
| 43 | + width: 120, | ||
| 44 | + height: 120, | ||
| 45 | + decoration: BoxDecoration( | ||
| 46 | + borderRadius: BorderRadius.circular(8), | ||
| 47 | + image: const DecorationImage( | ||
| 48 | + image: AssetImage('assets/images/logo.png'), | ||
| 49 | + ), | ||
| 50 | + ), | ||
| 51 | + ), | ||
| 52 | + const Spacer(), | ||
| 53 | + Expanded( | ||
| 54 | + child: Center( | ||
| 55 | + child: Column( | ||
| 56 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 57 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 58 | + children: [ | ||
| 59 | + Text( | ||
| 60 | + "发布临境,让更多人身临其境", | ||
| 61 | + style: TextStyle(fontSize: 14.px), | ||
| 62 | + ), | ||
| 63 | + Gaps.vGap10, | ||
| 64 | + TextButton( | ||
| 65 | + style: ButtonStyle( | ||
| 66 | + side: MaterialStateProperty.all( | ||
| 67 | + BorderSide( | ||
| 68 | + color: Colors.black54, | ||
| 69 | + width: 1.px, | ||
| 70 | + ), | ||
| 71 | + ), | ||
| 72 | + ), | ||
| 73 | + onPressed: () { | ||
| 74 | + NavigatorUtils.push( | ||
| 75 | + context, | ||
| 76 | + Routes.home, | ||
| 77 | + clearStack: true, | ||
| 78 | + ); | ||
| 79 | + }, | ||
| 80 | + child: Text( | ||
| 81 | + "完成", | ||
| 82 | + style: | ||
| 83 | + TextStyle(color: Colors.black54, fontSize: 15.px), | ||
| 84 | + ), | ||
| 85 | + ), | ||
| 86 | + ], | ||
| 87 | + ), | ||
| 88 | + ), | ||
| 89 | + ), | ||
| 90 | + ], | ||
| 91 | + ), | ||
| 92 | + ), | ||
| 93 | + ); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + Future<bool> _isExit() async { | ||
| 97 | + NavigatorUtils.push(context, Routes.home, clearStack: true); | ||
| 98 | + return Future.value(false); | ||
| 99 | + } | ||
| 100 | +} |
| ... | @@ -7,6 +7,8 @@ import 'package:one_poem/widgets/my_app_bar.dart'; | ... | @@ -7,6 +7,8 @@ import 'package:one_poem/widgets/my_app_bar.dart'; |
| 7 | 7 | ||
| 8 | import 'package:one_poem/extension/int_extension.dart'; | 8 | import 'package:one_poem/extension/int_extension.dart'; |
| 9 | 9 | ||
| 10 | +import '../poem_router.dart'; | ||
| 11 | + | ||
| 10 | class PoemPublish extends StatefulWidget { | 12 | class PoemPublish extends StatefulWidget { |
| 11 | const PoemPublish({Key? key, required this.data}) : super(key: key); | 13 | const PoemPublish({Key? key, required this.data}) : super(key: key); |
| 12 | 14 | ||
| ... | @@ -134,7 +136,7 @@ class _PoemPublishState extends State<PoemPublish> { | ... | @@ -134,7 +136,7 @@ class _PoemPublishState extends State<PoemPublish> { |
| 134 | ), | 136 | ), |
| 135 | ), | 137 | ), |
| 136 | onPressed: () { | 138 | onPressed: () { |
| 137 | - Toast.show("先不发布了吧。。。。"); | 139 | + publishPoem(context); |
| 138 | }, | 140 | }, |
| 139 | child: Text( | 141 | child: Text( |
| 140 | "发布", | 142 | "发布", |
| ... | @@ -152,6 +154,13 @@ class _PoemPublishState extends State<PoemPublish> { | ... | @@ -152,6 +154,13 @@ class _PoemPublishState extends State<PoemPublish> { |
| 152 | ); | 154 | ); |
| 153 | } | 155 | } |
| 154 | 156 | ||
| 157 | + void publishPoem(BuildContext context) { | ||
| 158 | + NavigatorUtils.push( | ||
| 159 | + context, | ||
| 160 | + '${PoemRouter.poemCompletePage}?id=100', | ||
| 161 | + ); | ||
| 162 | + } | ||
| 163 | + | ||
| 155 | Future<bool> _isExit() async { | 164 | Future<bool> _isExit() async { |
| 156 | showDialog( | 165 | showDialog( |
| 157 | context: context, | 166 | context: context, | ... | ... |
| 1 | import 'package:fluro/fluro.dart'; | 1 | import 'package:fluro/fluro.dart'; |
| 2 | import 'package:one_poem/poem/page/poem_record_audio.dart'; | 2 | import 'package:one_poem/poem/page/poem_record_audio.dart'; |
| 3 | import 'package:one_poem/routers/i_router.dart'; | 3 | import 'package:one_poem/routers/i_router.dart'; |
| 4 | +import 'page/poem_complete_page.dart'; | ||
| 4 | import 'page/poem_detail.dart'; | 5 | import 'page/poem_detail.dart'; |
| 5 | import 'page/poem_page.dart'; | 6 | import 'page/poem_page.dart'; |
| 6 | import 'page/poem_publish.dart'; | 7 | import 'page/poem_publish.dart'; |
| ... | @@ -14,6 +15,7 @@ class PoemRouter implements IRouterProvider { | ... | @@ -14,6 +15,7 @@ class PoemRouter implements IRouterProvider { |
| 14 | static String poemRecordVideoPage = '/poem/record/video'; | 15 | static String poemRecordVideoPage = '/poem/record/video'; |
| 15 | static String poemVideoPlayer = '/poem/video/player'; | 16 | static String poemVideoPlayer = '/poem/video/player'; |
| 16 | static String poemPublish = '/poem/publish'; | 17 | static String poemPublish = '/poem/publish'; |
| 18 | + static String poemCompletePage = '/poem/complete'; | ||
| 17 | 19 | ||
| 18 | @override | 20 | @override |
| 19 | void initRouter(FluroRouter router) { | 21 | void initRouter(FluroRouter router) { |
| ... | @@ -81,5 +83,17 @@ class PoemRouter implements IRouterProvider { | ... | @@ -81,5 +83,17 @@ class PoemRouter implements IRouterProvider { |
| 81 | }, | 83 | }, |
| 82 | ), | 84 | ), |
| 83 | ); | 85 | ); |
| 86 | + | ||
| 87 | + router.define( | ||
| 88 | + poemCompletePage, | ||
| 89 | + handler: Handler( | ||
| 90 | + handlerFunc: (_, Map<String, List<String>> params) { | ||
| 91 | + String? data = params['id']?.first; | ||
| 92 | + return PoemCompletePage( | ||
| 93 | + data: data!, | ||
| 94 | + ); | ||
| 95 | + }, | ||
| 96 | + ), | ||
| 97 | + ); | ||
| 84 | } | 98 | } |
| 85 | } | 99 | } | ... | ... |
-
Please register or login to post a comment