From 98670c0d24ec3b377525aa48ac3982438d2423cd Mon Sep 17 00:00:00 2001 From: wuqifeng <540416539@qq.com> Date: Tue, 7 May 2024 02:34:27 +0800 Subject: [PATCH] feat:练习顶部页码居中显示 --- lib/pages/practice/widgets/practice_header_widget.dart | 70 +++++++++++++++++++++++++++++++++------------------------------------- lib/pages/shop/home/shop_home_page.dart | 4 ++-- 2 files changed, 35 insertions(+), 39 deletions(-) diff --git a/lib/pages/practice/widgets/practice_header_widget.dart b/lib/pages/practice/widgets/practice_header_widget.dart index 456f314..1d7a091 100644 --- a/lib/pages/practice/widgets/practice_header_widget.dart +++ b/lib/pages/practice/widgets/practice_header_widget.dart @@ -14,46 +14,42 @@ class PracticeHeaderWidget extends StatelessWidget { return Container( color: Colors.white, height: 60.h, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: EdgeInsets.only( - left: ScreenUtil().bottomBarHeight - ), - child: IconButton( - onPressed: (){ - onTap(); - }, - icon: Image.asset( - 'back_around'.assetPng, - width: 40, - height: 40, - )), + child: AppBar( + leading: IconButton( + icon: Image.asset( + 'back_around'.assetPng, + width: 40, + height: 40, ), - Container( - height: 40.h, - padding: EdgeInsets.symmetric(horizontal: 27.w), - decoration: BoxDecoration( - color: const Color(0xFF00B6F1), - borderRadius: BorderRadius.circular(20.r), - border: Border.all( - width: 1.0, - color: const Color(0xFF333333), - ), - ), - alignment: Alignment.center, - child: Text( - title, - style: TextStyle( - fontSize: 20.sp, - color: Colors.white + onPressed: () { + onTap(); + }, + ), + centerTitle: true, + title: IntrinsicWidth( + child: Container( + height: 40.h, + padding: EdgeInsets.symmetric(horizontal: 27.w), + decoration: BoxDecoration( + color: const Color(0xFF00B6F1), + borderRadius: BorderRadius.circular(20.r), + border: Border.all( + width: 1.0, + color: const Color(0xFF333333), + ), ), - ), + child: Center( + child: Text( + title, + style: TextStyle( + fontSize: 15.sp, + color: Colors.white + ), + ), + ) ), - ScreenUtil().bottomBarHeight.horizontalSpace, - ], - ), + ) + ) ); } } \ No newline at end of file diff --git a/lib/pages/shop/home/shop_home_page.dart b/lib/pages/shop/home/shop_home_page.dart index 4c2789e..56f44f7 100644 --- a/lib/pages/shop/home/shop_home_page.dart +++ b/lib/pages/shop/home/shop_home_page.dart @@ -62,14 +62,14 @@ class _ShopHomeView extends StatelessWidget { ), body: Center( child: Padding( - padding: EdgeInsets.symmetric(vertical: 25.h, horizontal: 25.w), + padding: EdgeInsets.symmetric(vertical: 24.h, horizontal: 24.w), child: GridView.builder( itemCount: bloc.productDatas.length, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, childAspectRatio: 2, mainAxisSpacing: 14.h, - crossAxisSpacing: 4.5.w, + crossAxisSpacing: 6.w, ), itemBuilder: (BuildContext context, int index) { final productEntity = bloc.productDatas[index]; -- libgit2 0.22.2