Commit 98670c0d24ec3b377525aa48ac3982438d2423cd
1 parent
578775ca
feat:练习顶部页码居中显示
Showing
2 changed files
with
35 additions
and
39 deletions
lib/pages/practice/widgets/practice_header_widget.dart
... | ... | @@ -14,46 +14,42 @@ class PracticeHeaderWidget extends StatelessWidget { |
14 | 14 | return Container( |
15 | 15 | color: Colors.white, |
16 | 16 | height: 60.h, |
17 | - child: Row( | |
18 | - mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
19 | - children: [ | |
20 | - Padding( | |
21 | - padding: EdgeInsets.only( | |
22 | - left: ScreenUtil().bottomBarHeight | |
23 | - ), | |
24 | - child: IconButton( | |
25 | - onPressed: (){ | |
26 | - onTap(); | |
27 | - }, | |
28 | - icon: Image.asset( | |
29 | - 'back_around'.assetPng, | |
30 | - width: 40, | |
31 | - height: 40, | |
32 | - )), | |
17 | + child: AppBar( | |
18 | + leading: IconButton( | |
19 | + icon: Image.asset( | |
20 | + 'back_around'.assetPng, | |
21 | + width: 40, | |
22 | + height: 40, | |
33 | 23 | ), |
34 | - Container( | |
35 | - height: 40.h, | |
36 | - padding: EdgeInsets.symmetric(horizontal: 27.w), | |
37 | - decoration: BoxDecoration( | |
38 | - color: const Color(0xFF00B6F1), | |
39 | - borderRadius: BorderRadius.circular(20.r), | |
40 | - border: Border.all( | |
41 | - width: 1.0, | |
42 | - color: const Color(0xFF333333), | |
43 | - ), | |
44 | - ), | |
45 | - alignment: Alignment.center, | |
46 | - child: Text( | |
47 | - title, | |
48 | - style: TextStyle( | |
49 | - fontSize: 20.sp, | |
50 | - color: Colors.white | |
24 | + onPressed: () { | |
25 | + onTap(); | |
26 | + }, | |
27 | + ), | |
28 | + centerTitle: true, | |
29 | + title: IntrinsicWidth( | |
30 | + child: Container( | |
31 | + height: 40.h, | |
32 | + padding: EdgeInsets.symmetric(horizontal: 27.w), | |
33 | + decoration: BoxDecoration( | |
34 | + color: const Color(0xFF00B6F1), | |
35 | + borderRadius: BorderRadius.circular(20.r), | |
36 | + border: Border.all( | |
37 | + width: 1.0, | |
38 | + color: const Color(0xFF333333), | |
39 | + ), | |
51 | 40 | ), |
52 | - ), | |
41 | + child: Center( | |
42 | + child: Text( | |
43 | + title, | |
44 | + style: TextStyle( | |
45 | + fontSize: 15.sp, | |
46 | + color: Colors.white | |
47 | + ), | |
48 | + ), | |
49 | + ) | |
53 | 50 | ), |
54 | - ScreenUtil().bottomBarHeight.horizontalSpace, | |
55 | - ], | |
56 | - ), | |
51 | + ) | |
52 | + ) | |
57 | 53 | ); |
58 | 54 | } |
59 | 55 | } |
60 | 56 | \ No newline at end of file | ... | ... |
lib/pages/shop/home/shop_home_page.dart
... | ... | @@ -62,14 +62,14 @@ class _ShopHomeView extends StatelessWidget { |
62 | 62 | ), |
63 | 63 | body: Center( |
64 | 64 | child: Padding( |
65 | - padding: EdgeInsets.symmetric(vertical: 25.h, horizontal: 25.w), | |
65 | + padding: EdgeInsets.symmetric(vertical: 24.h, horizontal: 24.w), | |
66 | 66 | child: GridView.builder( |
67 | 67 | itemCount: bloc.productDatas.length, |
68 | 68 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
69 | 69 | crossAxisCount: 2, |
70 | 70 | childAspectRatio: 2, |
71 | 71 | mainAxisSpacing: 14.h, |
72 | - crossAxisSpacing: 4.5.w, | |
72 | + crossAxisSpacing: 6.w, | |
73 | 73 | ), |
74 | 74 | itemBuilder: (BuildContext context, int index) { |
75 | 75 | final productEntity = bloc.productDatas[index]; | ... | ... |