Commit 95edef4f496693eeacfa9922e282805526349c6c
1 parent
6fb826a3
feat:更新适配代码
Showing
9 changed files
with
95 additions
and
3 deletions
assets/images/home.png
0 → 100644
17.7 KB
assets/images/listen.png
0 → 100644
16.9 KB
assets/images/shop.png
0 → 100644
10.7 KB
assets/images/video.png
0 → 100644
13.4 KB
lib/app/app.dart
| @@ -11,8 +11,6 @@ class App extends StatelessWidget { | @@ -11,8 +11,6 @@ class App extends StatelessWidget { | ||
| 11 | @override | 11 | @override |
| 12 | Widget build(BuildContext context) { | 12 | Widget build(BuildContext context) { |
| 13 | return ScreenUtilInit( | 13 | return ScreenUtilInit( |
| 14 | - minTextAdapt: true, | ||
| 15 | - splitScreenMode: true, | ||
| 16 | designSize: const Size(667, 375), | 14 | designSize: const Size(667, 375), |
| 17 | builder: (_,__) => MultiBlocProvider( | 15 | builder: (_,__) => MultiBlocProvider( |
| 18 | providers: [ | 16 | providers: [ |
lib/home/home_page.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:wow_english/home/widgets/home_tab_header_widget.dart'; | ||
| 3 | + | ||
| 4 | +class HomePage extends StatelessWidget { | ||
| 5 | + const HomePage({super.key}); | ||
| 6 | + | ||
| 7 | + @override | ||
| 8 | + Widget build(BuildContext context) { | ||
| 9 | + return Scaffold( | ||
| 10 | + body: SafeArea( | ||
| 11 | + child: Container( | ||
| 12 | + color: Colors.white, | ||
| 13 | + child: const Center( | ||
| 14 | + child: Column( | ||
| 15 | + children: [ | ||
| 16 | + HomeTabHeaderWidget(), | ||
| 17 | + ], | ||
| 18 | + ), | ||
| 19 | + ), | ||
| 20 | + ), | ||
| 21 | + ), | ||
| 22 | + ); | ||
| 23 | + } | ||
| 24 | +} | ||
| 0 | \ No newline at end of file | 25 | \ No newline at end of file |
lib/home/widgets/home_tab_header_widget.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +import 'package:wow_english/common/extension/string_extension.dart'; | ||
| 4 | + | ||
| 5 | +class HomeTabHeaderWidget extends StatelessWidget { | ||
| 6 | + const HomeTabHeaderWidget({super.key}); | ||
| 7 | + | ||
| 8 | + @override | ||
| 9 | + Widget build(BuildContext context) { | ||
| 10 | + return Container( | ||
| 11 | + height: 45.h, | ||
| 12 | + width: double.infinity, | ||
| 13 | + color: Colors.purple, | ||
| 14 | + padding: EdgeInsets.symmetric(horizontal: 9.5.w), | ||
| 15 | + child: Row( | ||
| 16 | + children: [ | ||
| 17 | + ClipRRect( | ||
| 18 | + borderRadius:BorderRadius.circular(21), | ||
| 19 | + child: Image.network( | ||
| 20 | + 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Faa1c2213-820a-4223-8757-5f8cee318a28%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1688713226&t=192b18a613683bcdc5bd76f65c9ff032', | ||
| 21 | + height: 42, | ||
| 22 | + width: 42, | ||
| 23 | + fit: BoxFit.fill, | ||
| 24 | + ), | ||
| 25 | + ), | ||
| 26 | + Container( | ||
| 27 | + color: Colors.white, | ||
| 28 | + margin: const EdgeInsets.only(left: 7), | ||
| 29 | + padding: const EdgeInsets.all(7.0), | ||
| 30 | + child: const Text('franky'), | ||
| 31 | + ), | ||
| 32 | + 20.horizontalSpace, | ||
| 33 | + const Expanded( | ||
| 34 | + child:Text( | ||
| 35 | + 'learn wow!yellow', | ||
| 36 | + textAlign:TextAlign.left, | ||
| 37 | + style: TextStyle( | ||
| 38 | + color: Colors.white, | ||
| 39 | + fontSize: 30.0 | ||
| 40 | + ), | ||
| 41 | + ) | ||
| 42 | + ), | ||
| 43 | + IconButton( | ||
| 44 | + onPressed: (){}, | ||
| 45 | + icon: Image.asset('video'.assetPng) | ||
| 46 | + ), | ||
| 47 | + IconButton( | ||
| 48 | + onPressed: (){}, | ||
| 49 | + icon: Image.asset('home'.assetPng) | ||
| 50 | + ), | ||
| 51 | + IconButton( | ||
| 52 | + onPressed: (){}, | ||
| 53 | + icon: Image.asset('listen'.assetPng) | ||
| 54 | + ), | ||
| 55 | + IconButton( | ||
| 56 | + onPressed: (){}, | ||
| 57 | + icon: Image.asset('shop'.assetPng) | ||
| 58 | + ) | ||
| 59 | + ], | ||
| 60 | + ), | ||
| 61 | + ); | ||
| 62 | + } | ||
| 63 | +} | ||
| 0 | \ No newline at end of file | 64 | \ No newline at end of file |
lib/login/login_page.dart
| @@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; | @@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; | ||
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 4 | import 'package:wow_english/common/extension/string_extension.dart'; | 4 | import 'package:wow_english/common/extension/string_extension.dart'; |
| 5 | import 'package:wow_english/login/blocs/login_bloc.dart'; | 5 | import 'package:wow_english/login/blocs/login_bloc.dart'; |
| 6 | +import 'package:wow_english/route/route.dart'; | ||
| 6 | 7 | ||
| 7 | class LoginPage extends StatelessWidget { | 8 | class LoginPage extends StatelessWidget { |
| 8 | const LoginPage({super.key}); | 9 | const LoginPage({super.key}); |
| @@ -294,7 +295,9 @@ class LoginPage extends StatelessWidget { | @@ -294,7 +295,9 @@ class LoginPage extends StatelessWidget { | ||
| 294 | ), | 295 | ), |
| 295 | 5.horizontalSpace, | 296 | 5.horizontalSpace, |
| 296 | GestureDetector( | 297 | GestureDetector( |
| 297 | - onTap: () => bloc.add(ForgetPasswordEvent()), | 298 | + onTap: () { |
| 299 | + Navigator.of(context).pushNamed(AppRouteName.home); | ||
| 300 | + }, | ||
| 298 | child: Container( | 301 | child: Container( |
| 299 | width: 100.w, | 302 | width: 100.w, |
| 300 | height: 55.h, | 303 | height: 55.h, |
lib/route/route.dart
| 1 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
| 2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 3 | import 'package:wow_english/app/splash_page.dart'; | 3 | import 'package:wow_english/app/splash_page.dart'; |
| 4 | +import 'package:wow_english/home/home_page.dart'; | ||
| 4 | import 'package:wow_english/login/login_page.dart'; | 5 | import 'package:wow_english/login/login_page.dart'; |
| 5 | import 'package:wow_english/tab/tab_page.dart'; | 6 | import 'package:wow_english/tab/tab_page.dart'; |
| 6 | 7 | ||
| @@ -8,6 +9,7 @@ import 'package:wow_english/tab/tab_page.dart'; | @@ -8,6 +9,7 @@ import 'package:wow_english/tab/tab_page.dart'; | ||
| 8 | class AppRouteName { | 9 | class AppRouteName { |
| 9 | static const String splash = 'splash'; | 10 | static const String splash = 'splash'; |
| 10 | static const String login = 'login'; | 11 | static const String login = 'login'; |
| 12 | + static const String home = 'home'; | ||
| 11 | static const String tab = '/'; | 13 | static const String tab = '/'; |
| 12 | } | 14 | } |
| 13 | 15 | ||
| @@ -26,6 +28,8 @@ class AppRouter { | @@ -26,6 +28,8 @@ class AppRouter { | ||
| 26 | transitionsBuilder: (_, __, ___, child) => child); | 28 | transitionsBuilder: (_, __, ___, child) => child); |
| 27 | case AppRouteName.login: | 29 | case AppRouteName.login: |
| 28 | return CupertinoPageRoute(builder: (_) => const LoginPage()); | 30 | return CupertinoPageRoute(builder: (_) => const LoginPage()); |
| 31 | + case AppRouteName.home: | ||
| 32 | + return CupertinoPageRoute(builder: (_) => const HomePage()); | ||
| 29 | case AppRouteName.tab: | 33 | case AppRouteName.tab: |
| 30 | return PageRouteBuilder( | 34 | return PageRouteBuilder( |
| 31 | opaque: false, | 35 | opaque: false, |