Showing
9 changed files
with
406 additions
and
116 deletions
| 1 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 1 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| 2 | package="com.mofunsky.one_poem"> | 2 | package="com.mofunsky.one_poem"> |
| 3 | <application | 3 | <application |
| 4 | - android:label="one_poem" | 4 | + android:label="一言" |
| 5 | android:icon="@mipmap/ic_launcher"> | 5 | android:icon="@mipmap/ic_launcher"> |
| 6 | <activity | 6 | <activity |
| 7 | android:name=".MainActivity" | 7 | android:name=".MainActivity" | ... | ... |
| ... | @@ -10,7 +10,9 @@ class AccountRouter implements IRouterProvider{ | ... | @@ -10,7 +10,9 @@ class AccountRouter implements IRouterProvider{ |
| 10 | 10 | ||
| 11 | @override | 11 | @override |
| 12 | void initRouter(FluroRouter router) { | 12 | void initRouter(FluroRouter router) { |
| 13 | - router.define(accountPage, handler: Handler(handlerFunc: (_, __) => const AccountPage())); | 13 | + router.define(accountPage, handler: Handler(handlerFunc: (_, __) { |
| 14 | + return const AccountPage(isSelfPage: true,); | ||
| 15 | + })); | ||
| 14 | } | 16 | } |
| 15 | 17 | ||
| 16 | } | 18 | } | ... | ... |
| 1 | -import 'package:common_utils/common_utils.dart'; | ||
| 2 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 3 | -import 'package:one_poem/res/gaps.dart'; | 2 | +import 'package:one_poem/tiktok/style/style.dart'; |
| 4 | -import 'package:one_poem/res/resources.dart'; | ||
| 5 | -import 'package:one_poem/routers/fluro_navigator.dart'; | ||
| 6 | -import 'package:one_poem/util/image_utils.dart'; | ||
| 7 | -import 'package:one_poem/widgets/click_item.dart'; | ||
| 8 | import 'package:one_poem/widgets/my_app_bar.dart'; | 3 | import 'package:one_poem/widgets/my_app_bar.dart'; |
| 9 | -import 'package:one_poem/widgets/rise_number_text.dart'; | 4 | +import 'package:tapped/tapped.dart'; |
| 5 | +import 'package:flutter_gen/gen_l10n/one_poem_localizations.dart'; | ||
| 10 | 6 | ||
| 11 | -import '../account_router.dart'; | ||
| 12 | - | ||
| 13 | -/// design/6店铺-账户/index.html#artboard2 | ||
| 14 | class AccountPage extends StatefulWidget { | 7 | class AccountPage extends StatefulWidget { |
| 8 | + const AccountPage({ | ||
| 9 | + Key? key, | ||
| 10 | + this.canPop = false, | ||
| 11 | + this.onPop, | ||
| 12 | + this.isSelfPage, | ||
| 13 | + this.onSwitch, | ||
| 14 | + }) : super(key: key); | ||
| 15 | 15 | ||
| 16 | - const AccountPage({Key? key}) : super(key: key); | 16 | + final bool canPop; |
| 17 | + final bool? isSelfPage; | ||
| 18 | + final Function? onPop; | ||
| 19 | + final Function? onSwitch; | ||
| 17 | 20 | ||
| 18 | @override | 21 | @override |
| 19 | _AccountPageState createState() => _AccountPageState(); | 22 | _AccountPageState createState() => _AccountPageState(); |
| ... | @@ -22,106 +25,370 @@ class AccountPage extends StatefulWidget { | ... | @@ -22,106 +25,370 @@ class AccountPage extends StatefulWidget { |
| 22 | class _AccountPageState extends State<AccountPage> { | 25 | class _AccountPageState extends State<AccountPage> { |
| 23 | @override | 26 | @override |
| 24 | Widget build(BuildContext context) { | 27 | Widget build(BuildContext context) { |
| 25 | - return Scaffold( | 28 | + Widget likeButton = Container( |
| 26 | - appBar: const MyAppBar( | 29 | + color: ColorPlate.back1, |
| 27 | - centerTitle: '资金管理', | 30 | + child: Row( |
| 31 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 32 | + mainAxisAlignment: MainAxisAlignment.end, | ||
| 33 | + children: const <Widget>[ | ||
| 34 | + Tapped( | ||
| 35 | + child: _UserRightButton( | ||
| 36 | + title: '钱包', | ||
| 37 | + ), | ||
| 38 | + ), | ||
| 39 | + ], | ||
| 28 | ), | 40 | ), |
| 29 | - body: SingleChildScrollView( | 41 | + ); |
| 30 | - child: Column( | 42 | + Widget avatar = Container( |
| 31 | - children: <Widget>[ | 43 | + height: 120 + MediaQuery.of(context).padding.top, |
| 32 | - Gaps.vGap5, | 44 | + padding: const EdgeInsets.only(left: 18), |
| 33 | - _buildCard(), | 45 | + alignment: Alignment.bottomLeft, |
| 34 | - Gaps.vGap5, | 46 | + child: OverflowBox( |
| 35 | - ClickItem( | 47 | + alignment: Alignment.bottomLeft, |
| 36 | - title: '提现', | 48 | + minHeight: 20, |
| 37 | - onTap: () => NavigatorUtils.push(context, AccountRouter.accountPage),//TODO | 49 | + maxHeight: 300, |
| 50 | + child: Container( | ||
| 51 | + height: 74, | ||
| 52 | + width: 74, | ||
| 53 | + margin: const EdgeInsets.only(bottom: 12), | ||
| 54 | + decoration: BoxDecoration( | ||
| 55 | + borderRadius: BorderRadius.circular(44), | ||
| 56 | + color: Colors.orange, | ||
| 57 | + border: Border.all( | ||
| 58 | + color: Colors.white, | ||
| 59 | + width: 1, | ||
| 38 | ), | 60 | ), |
| 39 | - ClickItem( | 61 | + ), |
| 40 | - title: '提现记录', | 62 | + child: ClipOval( |
| 41 | - onTap: () => NavigatorUtils.push(context, AccountRouter.accountPage),//TODO | 63 | + child: Image.network( |
| 64 | + "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif", | ||
| 65 | + fit: BoxFit.cover, | ||
| 42 | ), | 66 | ), |
| 43 | - ClickItem( | 67 | + ), |
| 44 | - title: '提现密码', | 68 | + ), |
| 45 | - onTap: () => NavigatorUtils.push(context, AccountRouter.accountPage),//TODO | 69 | + ), |
| 70 | + ); | ||
| 71 | + Widget body = ListView( | ||
| 72 | + physics: const BouncingScrollPhysics( | ||
| 73 | + parent: AlwaysScrollableScrollPhysics(), | ||
| 74 | + ), | ||
| 75 | + children: <Widget>[ | ||
| 76 | + Container(height: 20), | ||
| 77 | + // 头像与关注 | ||
| 78 | + Stack( | ||
| 79 | + alignment: Alignment.bottomLeft, | ||
| 80 | + children: <Widget>[likeButton, avatar], | ||
| 81 | + ), | ||
| 82 | + Container( | ||
| 83 | + color: ColorPlate.back1, | ||
| 84 | + child: Column( | ||
| 85 | + children: <Widget>[ | ||
| 86 | + Container( | ||
| 87 | + padding: const EdgeInsets.only(left: 18), | ||
| 88 | + color: ColorPlate.back1, | ||
| 89 | + child: Column( | ||
| 90 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 91 | + children: <Widget>[ | ||
| 92 | + const Text( | ||
| 93 | + '@唐宋八大家TOP8', | ||
| 94 | + style: StandardTextStyle.big, | ||
| 95 | + ), | ||
| 96 | + Container(height: 8), | ||
| 97 | + Text( | ||
| 98 | + '朴实无华,且枯燥', | ||
| 99 | + style: StandardTextStyle.smallWithOpacity.apply( | ||
| 100 | + color: Colors.white, | ||
| 101 | + ), | ||
| 102 | + ), | ||
| 103 | + Container(height: 10), | ||
| 104 | + Row( | ||
| 105 | + children: const <Widget>[ | ||
| 106 | + _UserTag(tag: '幽默'), | ||
| 107 | + _UserTag(tag: '机智'), | ||
| 108 | + _UserTag(tag: '枯燥'), | ||
| 109 | + _UserTag(tag: '狮子座'), | ||
| 110 | + ], | ||
| 111 | + ), | ||
| 112 | + Container(height: 10), | ||
| 113 | + ], | ||
| 114 | + ), | ||
| 115 | + ), | ||
| 116 | + Container( | ||
| 117 | + color: ColorPlate.back1, | ||
| 118 | + padding: const EdgeInsets.symmetric( | ||
| 119 | + horizontal: 8, | ||
| 120 | + vertical: 2, | ||
| 121 | + ), | ||
| 122 | + child: Row( | ||
| 123 | + mainAxisAlignment: MainAxisAlignment.start, | ||
| 124 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 125 | + children: const <Widget>[ | ||
| 126 | + TextGroup('356', '关注'), | ||
| 127 | + TextGroup('145万', '粉丝'), | ||
| 128 | + TextGroup('1423万', '获赞'), | ||
| 129 | + ], | ||
| 130 | + ), | ||
| 131 | + ), | ||
| 132 | + Container( | ||
| 133 | + height: 10, | ||
| 134 | + margin: const EdgeInsets.symmetric(horizontal: 12), | ||
| 135 | + decoration: BoxDecoration( | ||
| 136 | + border: Border( | ||
| 137 | + bottom: BorderSide( | ||
| 138 | + color: Colors.white.withOpacity(0.1), | ||
| 139 | + ), | ||
| 140 | + ), | ||
| 141 | + ), | ||
| 142 | + ), | ||
| 143 | + const _UserVideoTable(), | ||
| 144 | + ], | ||
| 145 | + ), | ||
| 146 | + ), | ||
| 147 | + ], | ||
| 148 | + ); | ||
| 149 | + return Scaffold( | ||
| 150 | + appBar: const MyAppBar( | ||
| 151 | + centerTitle: '我在', | ||
| 152 | + ), | ||
| 153 | + body: Container( | ||
| 154 | + decoration: const BoxDecoration( | ||
| 155 | + gradient: LinearGradient( | ||
| 156 | + begin: Alignment.topCenter, | ||
| 157 | + colors: <Color>[ | ||
| 158 | + Colors.orange, | ||
| 159 | + Colors.red, | ||
| 160 | + ], | ||
| 46 | ), | 161 | ), |
| 47 | - ], | 162 | + ), |
| 163 | + child: Stack( | ||
| 164 | + alignment: Alignment.topCenter, | ||
| 165 | + children: <Widget>[ | ||
| 166 | + Container( | ||
| 167 | + margin: const EdgeInsets.only(top: 400), | ||
| 168 | + height: double.infinity, | ||
| 169 | + width: double.infinity, | ||
| 170 | + color: ColorPlate.back1, | ||
| 171 | + ), | ||
| 172 | + body, | ||
| 173 | + ], | ||
| 174 | + ), | ||
| 175 | + )); | ||
| 176 | + } | ||
| 177 | +} | ||
| 178 | + | ||
| 179 | +class _UserRightButton extends StatelessWidget { | ||
| 180 | + const _UserRightButton({ | ||
| 181 | + Key? key, | ||
| 182 | + required this.title, | ||
| 183 | + }) : super(key: key); | ||
| 184 | + | ||
| 185 | + final String title; | ||
| 186 | + | ||
| 187 | + @override | ||
| 188 | + Widget build(BuildContext context) { | ||
| 189 | + return Container( | ||
| 190 | + padding: const EdgeInsets.symmetric( | ||
| 191 | + vertical: 6, | ||
| 192 | + horizontal: 20, | ||
| 193 | + ), | ||
| 194 | + margin: const EdgeInsets.all(8), | ||
| 195 | + alignment: Alignment.center, | ||
| 196 | + child: Text( | ||
| 197 | + title, | ||
| 198 | + style: const TextStyle(color: ColorPlate.orange), | ||
| 199 | + ), | ||
| 200 | + decoration: BoxDecoration( | ||
| 201 | + border: Border.all(color: ColorPlate.orange), | ||
| 202 | + borderRadius: BorderRadius.circular(4), | ||
| 203 | + ), | ||
| 204 | + ); | ||
| 205 | + } | ||
| 206 | +} | ||
| 207 | + | ||
| 208 | +class _UserTag extends StatelessWidget { | ||
| 209 | + final String? tag; | ||
| 210 | + const _UserTag({ | ||
| 211 | + Key? key, | ||
| 212 | + this.tag, | ||
| 213 | + }) : super(key: key); | ||
| 214 | + | ||
| 215 | + @override | ||
| 216 | + Widget build(BuildContext context) { | ||
| 217 | + return Container( | ||
| 218 | + margin: const EdgeInsets.symmetric(horizontal: 4), | ||
| 219 | + padding: const EdgeInsets.symmetric( | ||
| 220 | + vertical: 2, | ||
| 221 | + horizontal: 4, | ||
| 222 | + ), | ||
| 223 | + decoration: BoxDecoration( | ||
| 224 | + border: Border.all( | ||
| 225 | + color: Colors.white.withOpacity(0.3), | ||
| 48 | ), | 226 | ), |
| 49 | - ) | 227 | + borderRadius: BorderRadius.circular(4), |
| 228 | + ), | ||
| 229 | + child: Text( | ||
| 230 | + tag ?? '标签', | ||
| 231 | + style: StandardTextStyle.smallWithOpacity, | ||
| 232 | + ), | ||
| 50 | ); | 233 | ); |
| 51 | } | 234 | } |
| 235 | +} | ||
| 236 | + | ||
| 237 | +class _UserVideoTable extends StatelessWidget { | ||
| 238 | + const _UserVideoTable({ | ||
| 239 | + Key? key, | ||
| 240 | + }) : super(key: key); | ||
| 52 | 241 | ||
| 53 | - Widget _buildCard() { | 242 | + @override |
| 54 | - return AspectRatio( | 243 | + Widget build(BuildContext context) { |
| 55 | - aspectRatio: 1.85, | 244 | + return Column( |
| 56 | - child: Container( | 245 | + children: <Widget>[ |
| 57 | - margin: const EdgeInsets.symmetric(horizontal: 6.0), | 246 | + Container( |
| 58 | - padding: const EdgeInsets.all(6.0), | 247 | + color: ColorPlate.back1, |
| 59 | - decoration: BoxDecoration( | 248 | + padding: const EdgeInsets.symmetric( |
| 60 | - image: DecorationImage( | 249 | + vertical: 12, |
| 61 | - image: ImageUtils.getAssetImage('account/bg'), | ||
| 62 | - fit: BoxFit.fill, | ||
| 63 | ), | 250 | ), |
| 64 | - ), | 251 | + child: Row( |
| 65 | - child: Column( | 252 | + mainAxisAlignment: MainAxisAlignment.center, |
| 66 | - children: <Widget>[ | 253 | + crossAxisAlignment: CrossAxisAlignment.center, |
| 67 | - const _AccountMoney( | 254 | + children: <Widget>[ |
| 68 | - title: '当前余额(元)', | 255 | + _PointSelectTextButton( |
| 69 | - money: '30.12', | 256 | + true, |
| 70 | - alignment: MainAxisAlignment.end, | 257 | + OnePoemLocalizations.of(context) |
| 71 | - moneyTextStyle: TextStyle(color: Colors.white, fontSize: 32.0, fontWeight: FontWeight.bold, fontFamily: 'RobotoThin'), | 258 | + .onePoemBottomNavigationBarItemTitle, |
| 72 | - ), | ||
| 73 | - Expanded( | ||
| 74 | - child: Row( | ||
| 75 | - children: const <Widget>[ | ||
| 76 | - _AccountMoney(title: '累计结算金额', money: '20000'), | ||
| 77 | - _AccountMoney(title: '累计发放佣金', money: '0.02'), | ||
| 78 | - ], | ||
| 79 | ), | 259 | ), |
| 80 | - ), | 260 | + _PointSelectTextButton( |
| 261 | + false, | ||
| 262 | + OnePoemLocalizations.of(context) | ||
| 263 | + .timelineBottomNavigationBarItemTitle), | ||
| 264 | + _PointSelectTextButton( | ||
| 265 | + false, | ||
| 266 | + OnePoemLocalizations.of(context) | ||
| 267 | + .categoryBottomNavigationBarItemTitle), | ||
| 268 | + ], | ||
| 269 | + ), | ||
| 270 | + ), | ||
| 271 | + Row( | ||
| 272 | + children: const <Widget>[ | ||
| 273 | + _SmallVideo(), | ||
| 274 | + _SmallVideo(), | ||
| 275 | + _SmallVideo(), | ||
| 81 | ], | 276 | ], |
| 82 | ), | 277 | ), |
| 83 | - ), | 278 | + Row( |
| 279 | + children: const <Widget>[ | ||
| 280 | + _SmallVideo(), | ||
| 281 | + _SmallVideo(), | ||
| 282 | + _SmallVideo(), | ||
| 283 | + ], | ||
| 284 | + ), | ||
| 285 | + ], | ||
| 84 | ); | 286 | ); |
| 85 | } | 287 | } |
| 86 | } | 288 | } |
| 87 | 289 | ||
| 88 | -class _AccountMoney extends StatelessWidget { | 290 | +class _SmallVideo extends StatelessWidget { |
| 89 | - | 291 | + const _SmallVideo({ |
| 90 | - const _AccountMoney({ | ||
| 91 | Key? key, | 292 | Key? key, |
| 92 | - required this.title, | 293 | + }) : super(key: key); |
| 93 | - required this.money, | ||
| 94 | - this.alignment, | ||
| 95 | - this.moneyTextStyle | ||
| 96 | - }): super(key: key); | ||
| 97 | 294 | ||
| 295 | + @override | ||
| 296 | + Widget build(BuildContext context) { | ||
| 297 | + return Expanded( | ||
| 298 | + child: AspectRatio( | ||
| 299 | + aspectRatio: 3 / 4.0, | ||
| 300 | + child: Container( | ||
| 301 | + decoration: BoxDecoration( | ||
| 302 | + color: ColorPlate.darkGray, | ||
| 303 | + border: Border.all(color: Colors.black), | ||
| 304 | + ), | ||
| 305 | + alignment: Alignment.center, | ||
| 306 | + child: Text( | ||
| 307 | + '一言', | ||
| 308 | + style: TextStyle( | ||
| 309 | + color: Colors.white.withOpacity(0.1), | ||
| 310 | + fontSize: 18, | ||
| 311 | + fontWeight: FontWeight.w900, | ||
| 312 | + ), | ||
| 313 | + ), | ||
| 314 | + ), | ||
| 315 | + ), | ||
| 316 | + ); | ||
| 317 | + } | ||
| 318 | +} | ||
| 319 | + | ||
| 320 | +class _PointSelectTextButton extends StatelessWidget { | ||
| 321 | + final bool isSelect; | ||
| 98 | final String title; | 322 | final String title; |
| 99 | - final String money; | 323 | + final Function? onTap; |
| 100 | - final MainAxisAlignment? alignment; | 324 | + const _PointSelectTextButton( |
| 101 | - final TextStyle? moneyTextStyle; | 325 | + this.isSelect, |
| 326 | + this.title, { | ||
| 327 | + Key? key, | ||
| 328 | + this.onTap, | ||
| 329 | + }) : super(key: key); | ||
| 102 | 330 | ||
| 103 | @override | 331 | @override |
| 104 | Widget build(BuildContext context) { | 332 | Widget build(BuildContext context) { |
| 105 | return Expanded( | 333 | return Expanded( |
| 106 | - child: MergeSemantics( | 334 | + child: Row( |
| 107 | - child: Column( | 335 | + mainAxisAlignment: MainAxisAlignment.center, |
| 108 | - mainAxisAlignment: alignment ?? MainAxisAlignment.center, | 336 | + children: <Widget>[ |
| 109 | - children: <Widget>[ | 337 | + isSelect |
| 110 | - /// 横向撑开Column,扩大语义区域 | 338 | + ? Container( |
| 111 | - const SizedBox(width: double.infinity), | 339 | + width: 6, |
| 112 | - Text(title, style: const TextStyle(color: Colours.text_disabled, fontSize: Dimens.font_sp12)), | 340 | + height: 6, |
| 113 | - Gaps.vGap8, | 341 | + decoration: BoxDecoration( |
| 114 | - RiseNumberText( | 342 | + color: ColorPlate.orange, |
| 115 | - NumUtil.getDoubleByValueStr(money) ?? 0, | 343 | + borderRadius: BorderRadius.circular(3), |
| 116 | - style: moneyTextStyle ?? const TextStyle( | 344 | + ), |
| 117 | - color: Colours.text_disabled, | 345 | + ) |
| 118 | - fontSize: Dimens.font_sp14, | 346 | + : Container(), |
| 119 | - fontWeight: FontWeight.bold, | 347 | + Container( |
| 120 | - fontFamily: 'RobotoThin' | 348 | + padding: const EdgeInsets.only(left: 2), |
| 121 | - ) | 349 | + child: Text( |
| 350 | + title, | ||
| 351 | + style: isSelect | ||
| 352 | + ? StandardTextStyle.small | ||
| 353 | + : StandardTextStyle.smallWithOpacity, | ||
| 122 | ), | 354 | ), |
| 123 | - ], | 355 | + ) |
| 124 | - ), | 356 | + ], |
| 357 | + ), | ||
| 358 | + ); | ||
| 359 | + } | ||
| 360 | +} | ||
| 361 | + | ||
| 362 | +class TextGroup extends StatelessWidget { | ||
| 363 | + final String title, tag; | ||
| 364 | + final Color? color; | ||
| 365 | + | ||
| 366 | + const TextGroup( | ||
| 367 | + this.title, | ||
| 368 | + this.tag, { | ||
| 369 | + Key? key, | ||
| 370 | + this.color, | ||
| 371 | + }) : super(key: key); | ||
| 372 | + | ||
| 373 | + @override | ||
| 374 | + Widget build(BuildContext context) { | ||
| 375 | + return Container( | ||
| 376 | + padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 8), | ||
| 377 | + child: Row( | ||
| 378 | + crossAxisAlignment: CrossAxisAlignment.end, | ||
| 379 | + children: <Widget>[ | ||
| 380 | + Text( | ||
| 381 | + title, | ||
| 382 | + style: StandardTextStyle.big.apply(color: color), | ||
| 383 | + ), | ||
| 384 | + Container(width: 4), | ||
| 385 | + Text( | ||
| 386 | + tag, | ||
| 387 | + style: StandardTextStyle.smallWithOpacity.apply( | ||
| 388 | + color: color?.withOpacity(0.6), | ||
| 389 | + ), | ||
| 390 | + ), | ||
| 391 | + ], | ||
| 125 | ), | 392 | ), |
| 126 | ); | 393 | ); |
| 127 | } | 394 | } | ... | ... |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | +import 'package:one_poem/account/page/account_page.dart'; | ||
| 2 | import 'package:one_poem/goods/page/goods_page.dart'; | 3 | import 'package:one_poem/goods/page/goods_page.dart'; |
| 3 | import 'package:one_poem/poem/page/poem_page.dart'; | 4 | import 'package:one_poem/poem/page/poem_page.dart'; |
| 4 | import 'package:one_poem/res/resources.dart'; | 5 | import 'package:one_poem/res/resources.dart'; |
| ... | @@ -45,7 +46,7 @@ class _HomeState extends State<Home> with RestorationMixin { | ... | @@ -45,7 +46,7 @@ class _HomeState extends State<Home> with RestorationMixin { |
| 45 | const PoemPage(), | 46 | const PoemPage(), |
| 46 | const GoodsPage(), | 47 | const GoodsPage(), |
| 47 | const NotFoundPage(), | 48 | const NotFoundPage(), |
| 48 | - const ShopPage(), | 49 | + const AccountPage(), |
| 49 | ]; | 50 | ]; |
| 50 | } | 51 | } |
| 51 | 52 | ... | ... |
| ... | @@ -46,13 +46,18 @@ Future<void> main() async { | ... | @@ -46,13 +46,18 @@ Future<void> main() async { |
| 46 | /// sp初始化 | 46 | /// sp初始化 |
| 47 | await SpUtil.getInstance(); | 47 | await SpUtil.getInstance(); |
| 48 | 48 | ||
| 49 | + WidgetsFlutterBinding.ensureInitialized(); | ||
| 50 | + SystemChrome.setPreferredOrientations( | ||
| 51 | + [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]); | ||
| 52 | + | ||
| 49 | /// 1.22 预览功能: 在输入频率与显示刷新率不匹配情况下提供平滑的滚动效果 | 53 | /// 1.22 预览功能: 在输入频率与显示刷新率不匹配情况下提供平滑的滚动效果 |
| 50 | // GestureBinding.instance?.resamplingEnabled = true; | 54 | // GestureBinding.instance?.resamplingEnabled = true; |
| 51 | /// 异常处理 | 55 | /// 异常处理 |
| 52 | handleError(() => runApp(MyApp())); | 56 | handleError(() => runApp(MyApp())); |
| 53 | 57 | ||
| 54 | /// 隐藏状态栏。为启动页、引导页设置。完成后修改回显示状态栏。 | 58 | /// 隐藏状态栏。为启动页、引导页设置。完成后修改回显示状态栏。 |
| 55 | - SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.bottom]); | 59 | + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, |
| 60 | + overlays: [SystemUiOverlay.bottom]); | ||
| 56 | // TODO(weilu): 启动体验不佳。状态栏、导航栏在冷启动开始的一瞬间为黑色,且无法通过隐藏、修改颜色等方式进行处理。。。 | 61 | // TODO(weilu): 启动体验不佳。状态栏、导航栏在冷启动开始的一瞬间为黑色,且无法通过隐藏、修改颜色等方式进行处理。。。 |
| 57 | // 相关问题跟踪:https://github.com/flutter/flutter/issues/73351 | 62 | // 相关问题跟踪:https://github.com/flutter/flutter/issues/73351 |
| 58 | } | 63 | } |
| ... | @@ -108,10 +113,7 @@ class MyApp extends StatelessWidget { | ... | @@ -108,10 +113,7 @@ class MyApp extends StatelessWidget { |
| 108 | 113 | ||
| 109 | quickActions.setShortcutItems(<ShortcutItem>[ | 114 | quickActions.setShortcutItems(<ShortcutItem>[ |
| 110 | const ShortcutItem( | 115 | const ShortcutItem( |
| 111 | - type: 'demo', | 116 | + type: 'demo', localizedTitle: 'Demo', icon: 'flutter_dash_black'), |
| 112 | - localizedTitle: 'Demo', | ||
| 113 | - icon: 'flutter_dash_black' | ||
| 114 | - ), | ||
| 115 | ]); | 117 | ]); |
| 116 | } | 118 | } |
| 117 | } | 119 | } |
| ... | @@ -124,7 +126,8 @@ class MyApp extends StatelessWidget { | ... | @@ -124,7 +126,8 @@ class MyApp extends StatelessWidget { |
| 124 | ChangeNotifierProvider(create: (_) => LocaleProvider()) | 126 | ChangeNotifierProvider(create: (_) => LocaleProvider()) |
| 125 | ], | 127 | ], |
| 126 | child: Consumer2<ThemeProvider, LocaleProvider>( | 128 | child: Consumer2<ThemeProvider, LocaleProvider>( |
| 127 | - builder: (_, ThemeProvider provider, LocaleProvider localeProvider, __) { | 129 | + builder: |
| 130 | + (_, ThemeProvider provider, LocaleProvider localeProvider, __) { | ||
| 128 | return _buildMaterialApp(provider, localeProvider); | 131 | return _buildMaterialApp(provider, localeProvider); |
| 129 | }, | 132 | }, |
| 130 | ), | 133 | ), |
| ... | @@ -133,14 +136,15 @@ class MyApp extends StatelessWidget { | ... | @@ -133,14 +136,15 @@ class MyApp extends StatelessWidget { |
| 133 | /// Toast 配置 | 136 | /// Toast 配置 |
| 134 | return OKToast( | 137 | return OKToast( |
| 135 | backgroundColor: Colors.black54, | 138 | backgroundColor: Colors.black54, |
| 136 | - textPadding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 10.0), | 139 | + textPadding: |
| 140 | + const EdgeInsets.symmetric(horizontal: 16.0, vertical: 10.0), | ||
| 137 | radius: 20.0, | 141 | radius: 20.0, |
| 138 | position: ToastPosition.bottom, | 142 | position: ToastPosition.bottom, |
| 139 | - child: app | 143 | + child: app); |
| 140 | - ); | ||
| 141 | } | 144 | } |
| 142 | 145 | ||
| 143 | - Widget _buildMaterialApp(ThemeProvider provider, LocaleProvider localeProvider) { | 146 | + Widget _buildMaterialApp( |
| 147 | + ThemeProvider provider, LocaleProvider localeProvider) { | ||
| 144 | return MaterialApp( | 148 | return MaterialApp( |
| 145 | title: 'Flutter Deer', | 149 | title: 'Flutter Deer', |
| 146 | // showPerformanceOverlay: true, //显示性能标签 | 150 | // showPerformanceOverlay: true, //显示性能标签 | ... | ... |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | +import 'package:one_poem/tiktok/style/style.dart'; | ||
| 2 | import 'package:one_poem/widgets/my_app_bar.dart'; | 3 | import 'package:one_poem/widgets/my_app_bar.dart'; |
| 3 | 4 | ||
| 4 | class PoemDetailPage extends StatefulWidget { | 5 | class PoemDetailPage extends StatefulWidget { |
| 5 | 6 | ||
| 6 | const PoemDetailPage({ | 7 | const PoemDetailPage({ |
| 7 | Key? key, | 8 | Key? key, |
| 8 | - this.isAccessibilityTest = false, | 9 | + this.onPop, |
| 10 | + required this.poemId, | ||
| 9 | }) : super(key : key); | 11 | }) : super(key : key); |
| 10 | 12 | ||
| 11 | - final bool isAccessibilityTest; | 13 | + final int poemId; |
| 14 | + final Function? onPop; | ||
| 12 | 15 | ||
| 13 | @override | 16 | @override |
| 14 | _PoemDetailPageState createState() => _PoemDetailPageState(); | 17 | _PoemDetailPageState createState() => _PoemDetailPageState(); |
| ... | @@ -17,11 +20,27 @@ class PoemDetailPage extends StatefulWidget { | ... | @@ -17,11 +20,27 @@ class PoemDetailPage extends StatefulWidget { |
| 17 | class _PoemDetailPageState extends State<PoemDetailPage>{ | 20 | class _PoemDetailPageState extends State<PoemDetailPage>{ |
| 18 | @override | 21 | @override |
| 19 | Widget build(BuildContext context) { | 22 | Widget build(BuildContext context) { |
| 20 | - return const Scaffold( | 23 | + return Scaffold( |
| 21 | - appBar: MyAppBar( | 24 | + appBar: const MyAppBar( |
| 22 | - title: '一言|译解|临境', | 25 | + title: '一言', |
| 23 | ), | 26 | ), |
| 24 | - body: Text("题 破山此后禅院"), | 27 | + body: Container( |
| 28 | + decoration: const BoxDecoration( | ||
| 29 | + gradient: LinearGradient( | ||
| 30 | + begin: Alignment.topCenter, | ||
| 31 | + colors: <Color>[ | ||
| 32 | + Colors.black, | ||
| 33 | + Colors.black, | ||
| 34 | + ], | ||
| 35 | + ), | ||
| 36 | + ), | ||
| 37 | + child: Stack( | ||
| 38 | + alignment: Alignment.topCenter, | ||
| 39 | + children: <Widget>[ | ||
| 40 | + Text("题 破山寺后禅院"), | ||
| 41 | + ], | ||
| 42 | + ), | ||
| 43 | + ), | ||
| 25 | ); | 44 | ); |
| 26 | } | 45 | } |
| 27 | } | 46 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -13,6 +13,8 @@ import 'package:one_poem/tiktok/widgets/tiktok_video_button_column.dart'; | ... | @@ -13,6 +13,8 @@ import 'package:one_poem/tiktok/widgets/tiktok_video_button_column.dart'; |
| 13 | import 'package:one_poem/tiktok/widgets/tiktok_video_poem.dart'; | 13 | import 'package:one_poem/tiktok/widgets/tiktok_video_poem.dart'; |
| 14 | import 'package:video_player/video_player.dart'; | 14 | import 'package:video_player/video_player.dart'; |
| 15 | 15 | ||
| 16 | +import 'poem_detail.dart'; | ||
| 17 | + | ||
| 16 | class PoemPage extends StatefulWidget { | 18 | class PoemPage extends StatefulWidget { |
| 17 | const PoemPage({Key? key}) : super(key: key); | 19 | const PoemPage({Key? key}) : super(key: key); |
| 18 | 20 | ||
| ... | @@ -100,12 +102,10 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -100,12 +102,10 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 100 | }, | 102 | }, |
| 101 | ); | 103 | ); |
| 102 | 104 | ||
| 103 | - var userPage = UserPage( | 105 | + var detailPage = PoemDetailPage( |
| 104 | - isSelfPage: false, | 106 | + onPop: (){ |
| 105 | - canPop: true, | ||
| 106 | - onPop: () { | ||
| 107 | tkController.animateToMiddle(); | 107 | tkController.animateToMiddle(); |
| 108 | - }, | 108 | + }, poemId: 1, |
| 109 | ); | 109 | ); |
| 110 | var searchPage = SearchPage( | 110 | var searchPage = SearchPage( |
| 111 | onPop: tkController.animateToMiddle, | 111 | onPop: tkController.animateToMiddle, |
| ... | @@ -116,7 +116,7 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -116,7 +116,7 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 116 | controller: tkController, | 116 | controller: tkController, |
| 117 | header: header, | 117 | header: header, |
| 118 | leftPage: searchPage, | 118 | leftPage: searchPage, |
| 119 | - rightPage: userPage, | 119 | + rightPage: detailPage, |
| 120 | enableGesture: true, | 120 | enableGesture: true, |
| 121 | page: Stack( | 121 | page: Stack( |
| 122 | children: <Widget>[ | 122 | children: <Widget>[ | ... | ... |
| 1 | import 'package:fluro/fluro.dart'; | 1 | import 'package:fluro/fluro.dart'; |
| 2 | import 'package:one_poem/routers/i_router.dart'; | 2 | import 'package:one_poem/routers/i_router.dart'; |
| 3 | 3 | ||
| 4 | -import 'page/poem_detail.dart'; | ||
| 5 | import 'page/poem_page.dart'; | 4 | import 'page/poem_page.dart'; |
| 6 | 5 | ||
| 7 | class PoemRouter implements IRouterProvider{ | 6 | class PoemRouter implements IRouterProvider{ |
| 8 | 7 | ||
| 9 | static String poemPage = '/poem'; | 8 | static String poemPage = '/poem'; |
| 10 | - static String poemDetail = '/poem/detail'; | ||
| 11 | 9 | ||
| 12 | @override | 10 | @override |
| 13 | void initRouter(FluroRouter router) { | 11 | void initRouter(FluroRouter router) { |
| 14 | router.define(poemPage, handler: Handler(handlerFunc: (_, __) => const PoemPage())); | 12 | router.define(poemPage, handler: Handler(handlerFunc: (_, __) => const PoemPage())); |
| 15 | - router.define(poemDetail, handler: Handler(handlerFunc: (_, __) => const PoemDetailPage())); | ||
| 16 | } | 13 | } |
| 17 | 14 | ||
| 18 | } | 15 | } | ... | ... |
| ... | @@ -13,7 +13,7 @@ class UserPage extends StatefulWidget { | ... | @@ -13,7 +13,7 @@ class UserPage extends StatefulWidget { |
| 13 | Key? key, | 13 | Key? key, |
| 14 | this.canPop = false, | 14 | this.canPop = false, |
| 15 | this.onPop, | 15 | this.onPop, |
| 16 | - required this.isSelfPage, | 16 | + this.isSelfPage = false, |
| 17 | this.onSwitch, | 17 | this.onSwitch, |
| 18 | }) : super(key: key); | 18 | }) : super(key: key); |
| 19 | 19 | ... | ... |
-
Please register or login to post a comment