diff --git a/lib/pages/goods_details/widget/goods_details_bottom_bar.dart b/lib/pages/goods_details/widget/goods_details_bottom_bar.dart index 93f8b1c5..03123733 100644 --- a/lib/pages/goods_details/widget/goods_details_bottom_bar.dart +++ b/lib/pages/goods_details/widget/goods_details_bottom_bar.dart @@ -51,10 +51,10 @@ class _GoodsDetailsBottomBarState extends State { ], ), padding: EdgeInsets.only( - left: ScreenUtil().setWidth(35), - right: ScreenUtil().setWidth(35), - top: ScreenUtil().setWidth(13), - bottom: ScreenUtil().setWidth(47), + left: 35.w, + right: 35.w, + top: 13.w, + bottom: 47.w, ), child: Row( children: [ @@ -89,7 +89,7 @@ class _GoodsDetailsBottomBarState extends State { }); }, ), - SizedBox(width: ScreenUtil().setWidth(46)), + SizedBox(width: 46.w), InkWell( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -114,7 +114,7 @@ class _GoodsDetailsBottomBarState extends State { context, PageName.market_cart_page.toString()); }, ), - SizedBox(width: ScreenUtil().setWidth(53)), + SizedBox(width: 53.w), InkWell( child: Container( decoration: BoxDecoration( @@ -128,8 +128,8 @@ class _GoodsDetailsBottomBarState extends State { ], ), padding: EdgeInsets.symmetric( - horizontal: ScreenUtil().setWidth(40), - vertical: ScreenUtil().setWidth(12), + horizontal: 40.w, + vertical: 12.w, ), child: Text( '加入购物车', @@ -149,7 +149,7 @@ class _GoodsDetailsBottomBarState extends State { // // widget.itemprice, widget.itempic); // } //_showModelBotoomSheet, ), - SizedBox(width: ScreenUtil().setWidth(24)), + SizedBox(width: 24.w), InkWell( child: Container( decoration: BoxDecoration( @@ -163,8 +163,8 @@ class _GoodsDetailsBottomBarState extends State { ], ), padding: EdgeInsets.symmetric( - horizontal: ScreenUtil().setWidth(55), - vertical: ScreenUtil().setWidth(12), + horizontal: 55.w, + vertical: 12.w, ), child: Text( '立即购买', diff --git a/lib/pages/goods_details/widget/product_content.dart b/lib/pages/goods_details/widget/product_content.dart index 85de5449..4842b9e8 100644 --- a/lib/pages/goods_details/widget/product_content.dart +++ b/lib/pages/goods_details/widget/product_content.dart @@ -25,7 +25,7 @@ class ProductContent extends StatelessWidget { fontWeight: FontWeight.w500, ), ), - SizedBox(width: ScreenUtil().setWidth(10)), + SizedBox(width: 10.w), Text( '元', style: TextStyle( @@ -41,9 +41,9 @@ class ProductContent extends StatelessWidget { Container _containerTitle(String title) { return Container( margin: EdgeInsets.only( - top: ScreenUtil().setWidth(28), - bottom: ScreenUtil().setWidth(18), - right: ScreenUtil().setWidth(106), + top: 28.w, + bottom: 18.w, + right: 106.w, ), child: Text( title, @@ -57,7 +57,7 @@ class ProductContent extends StatelessWidget { Container _containerSubtitle(String shortTitle) { return Container( - margin: EdgeInsets.only(right: ScreenUtil().setWidth(286)), + margin: EdgeInsets.only(right: 286.w), child: Text( shortTitle, maxLines: 1, @@ -78,13 +78,13 @@ class ProductContent extends StatelessWidget { ], ), margin: EdgeInsets.only( - left: ScreenUtil().setWidth(72), - right: ScreenUtil().setWidth(72), - top: ScreenUtil().setWidth(58), + left: 72.w, + right: 72.w, + top: 58.w, ), padding: EdgeInsets.symmetric( - horizontal: ScreenUtil().setWidth(33), - vertical: ScreenUtil().setWidth(11), + horizontal: 33.w, + vertical: 11.w, ), child: Text( desc, @@ -101,15 +101,14 @@ class ProductContent extends StatelessWidget { Positioned _positionedShare() { return Positioned( right: 0, - top: ScreenUtil().setWidth(169), + top: 169.w, child: InkWell( onTap: () { shareToWeChat(WeChatShareWebPageModel( - 'https://mobile.baidu.com/item?docid=27505288', - - title:itemtitle, - description: '前往小蜜蜂智慧社区查看吧', - )); + 'https://mobile.baidu.com/item?docid=27505288', + title: itemtitle, + description: '前往小蜜蜂智慧社区查看吧', + )); }, child: Container( decoration: BoxDecoration( @@ -123,8 +122,8 @@ class ProductContent extends StatelessWidget { ], ), padding: EdgeInsets.symmetric( - horizontal: ScreenUtil().setWidth(14), - vertical: ScreenUtil().setWidth(9), + horizontal: 14.w, + vertical: 9.w, ), child: Row( children: [ @@ -132,7 +131,7 @@ class ProductContent extends StatelessWidget { SimpleLineIcons.share, size: ScreenUtil().setSp(20), ), - SizedBox(width: ScreenUtil().setWidth(12)), + SizedBox(width: 12.w), Text( '分享', style: TextStyle( @@ -149,7 +148,7 @@ class ProductContent extends StatelessWidget { Positioned _positionedRecommend() { return Positioned( - right: ScreenUtil().setWidth(453), + right: 453.w, bottom: 100.w, child: Row( children: [ @@ -158,7 +157,7 @@ class ProductContent extends StatelessWidget { color: Color(0xff999999), size: ScreenUtil().setSp(24), ), - SizedBox(width: ScreenUtil().setWidth(12)), + SizedBox(width: 12.w), Text( '推荐理由', style: TextStyle( @@ -177,9 +176,9 @@ class ProductContent extends StatelessWidget { children: [ Padding( padding: EdgeInsets.only( - left: ScreenUtil().setWidth(32), - top: ScreenUtil().setWidth(25), - bottom: ScreenUtil().setWidth(20), + left: 32.w, + top: 25.w, + bottom: 20.w, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/goods_details/widget/product_evaluate.dart b/lib/pages/goods_details/widget/product_evaluate.dart index ce66e68b..01fa027e 100644 --- a/lib/pages/goods_details/widget/product_evaluate.dart +++ b/lib/pages/goods_details/widget/product_evaluate.dart @@ -5,7 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; class ProductEvaluate extends StatelessWidget { final Function fun; - ProductEvaluate({Key key,this.fun}) : super(key: key); + ProductEvaluate({Key key, this.fun}) : super(key: key); Stack _stackEvaluateHeader() { return Stack( @@ -22,7 +22,7 @@ class ProductEvaluate extends StatelessWidget { ], ), Positioned( - right: ScreenUtil().setWidth(32), + right: 32.w, child: InkWell( onTap: () { fun(); @@ -36,7 +36,7 @@ class ProductEvaluate extends StatelessWidget { color: Color(0xff999999), ), ), - SizedBox(width: ScreenUtil().setWidth(20)), + SizedBox(width: 20.w), Icon( AntDesign.right, size: ScreenUtil().setSp(34), @@ -59,12 +59,12 @@ class ProductEvaluate extends StatelessWidget { ClipOval( child: Image.asset( 'assets/example/touxiang1.png', - height: ScreenUtil().setWidth(50), - width: ScreenUtil().setWidth(50), + height: 50.w, + width: 50.w, fit: BoxFit.fill, ), ), - SizedBox(width: ScreenUtil().setWidth(10)), + SizedBox(width: 10.w), Text( '就是安安啊', style: TextStyle( @@ -74,7 +74,7 @@ class ProductEvaluate extends StatelessWidget { ), ], ), - SizedBox(height: ScreenUtil().setWidth(12)), + SizedBox(height: 12.w), Text( '面料和版型都不错,会回购', maxLines: 2, @@ -92,16 +92,16 @@ class ProductEvaluate extends StatelessWidget { Widget build(BuildContext context) { return Container( color: Color(0xffffffff), - margin: EdgeInsets.only(top: ScreenUtil().setWidth(30)), + margin: EdgeInsets.only(top: 30.w), padding: EdgeInsets.only( - top: ScreenUtil().setWidth(20), - left: ScreenUtil().setWidth(32), - bottom: ScreenUtil().setWidth(32), + top: 20.w, + left: 32.w, + bottom: 32.w, ), child: Column( children: [ _stackEvaluateHeader(), - SizedBox(height: ScreenUtil().setWidth(32)), + SizedBox(height: 32.w), _columnEvaluateContent(), ], ), diff --git a/lib/pages/goods_details/widget/product_service.dart b/lib/pages/goods_details/widget/product_service.dart index 4a674a9d..a3881d82 100644 --- a/lib/pages/goods_details/widget/product_service.dart +++ b/lib/pages/goods_details/widget/product_service.dart @@ -16,7 +16,7 @@ class ProductService extends StatelessWidget { color: Color(0xff999999), ), ), - SizedBox(width: ScreenUtil().setWidth(59)), + SizedBox(width: 59.w), Row( children: [ Icon( @@ -25,7 +25,7 @@ class ProductService extends StatelessWidget { color: Color(0xff666666), ), SizedBox( - width: ScreenUtil().setWidth(9), + width: 9.w, ), Text( '浙江杭州', @@ -36,7 +36,7 @@ class ProductService extends StatelessWidget { ), ], ), - SizedBox(width: ScreenUtil().setWidth(38)), + SizedBox(width: 38.w), Row( children: [ Text( @@ -47,7 +47,7 @@ class ProductService extends StatelessWidget { ), ), SizedBox( - width: ScreenUtil().setWidth(9), + width: 9.w, ), Text( '全国包邮', @@ -72,7 +72,7 @@ class ProductService extends StatelessWidget { color: Color(0xff999999), ), ), - SizedBox(width: ScreenUtil().setWidth(59)), + SizedBox(width: 59.w), Text( '品质保证', style: TextStyle( @@ -80,15 +80,15 @@ class ProductService extends StatelessWidget { color: Color(0xff333333), ), ), - SizedBox(width: ScreenUtil().setWidth(16)), + SizedBox(width: 16.w), SizedBox( width: 1, - height: ScreenUtil().setWidth(24), + height: 24.w, child: DecoratedBox( decoration: BoxDecoration(color: Color(0xffd8d8d8)), ), ), - SizedBox(width: ScreenUtil().setWidth(16)), + SizedBox(width: 16.w), Text( '售后无忧', style: TextStyle( @@ -104,15 +104,15 @@ class ProductService extends StatelessWidget { Widget build(BuildContext context) { return Container( color: Color(0xffffffff), - margin: EdgeInsets.only(top: ScreenUtil().setWidth(30)), + margin: EdgeInsets.only(top: 30.w), padding: EdgeInsets.symmetric( - vertical: ScreenUtil().setWidth(20), - horizontal: ScreenUtil().setWidth(60), + vertical: 20.w, + horizontal: 60.w, ), child: Column( children: [ _rowDelivergoods(), - SizedBox(height: ScreenUtil().setWidth(39)), + SizedBox(height: 39.w), _rowService(), ], ), diff --git a/lib/pages/goods_details/widget/product_specs.dart b/lib/pages/goods_details/widget/product_specs.dart index 0c0e15ac..67407109 100644 --- a/lib/pages/goods_details/widget/product_specs.dart +++ b/lib/pages/goods_details/widget/product_specs.dart @@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:akuCommunity/widget/goods_specs_sheet.dart'; + class ProductSpecs extends StatefulWidget { ProductSpecs({Key key}) : super(key: key); @@ -28,11 +29,11 @@ class _ProductSpecsState extends State { onTap: _showModelBotoomSheet, child: Container( color: Color(0xffffffff), - margin: EdgeInsets.only(top: ScreenUtil().setWidth(30)), + margin: EdgeInsets.only(top: 30.w), padding: EdgeInsets.only( - left: ScreenUtil().setWidth(60), - top: ScreenUtil().setWidth(20), - bottom: ScreenUtil().setWidth(20), + left: 60.w, + top: 20.w, + bottom: 20.w, ), child: Stack( children: [ @@ -45,7 +46,7 @@ class _ProductSpecsState extends State { color: Color(0xff999999), ), ), - SizedBox(width: ScreenUtil().setWidth(59)), + SizedBox(width: 59.w), Text( '请选择规格', style: TextStyle( @@ -56,7 +57,7 @@ class _ProductSpecsState extends State { ], ), Positioned( - right: ScreenUtil().setWidth(32), + right: 32.w, child: Icon( AntDesign.right, size: ScreenUtil().setSp(34), diff --git a/lib/pages/goods_details/widget/product_swiper.dart b/lib/pages/goods_details/widget/product_swiper.dart index 11bbc85a..3a7fc5c8 100644 --- a/lib/pages/goods_details/widget/product_swiper.dart +++ b/lib/pages/goods_details/widget/product_swiper.dart @@ -27,7 +27,7 @@ class ProductSwiper extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - height: ScreenUtil().setWidth(500), + height: 500.w, child: Swiper( itemBuilder: (BuildContext context, int index) { return AspectRatio( @@ -63,9 +63,9 @@ class ProductSwiper extends StatelessWidget { builder: DotSwiperPaginationBuilder( activeColor: Color(0xffFEC200), color: Colors.white, - size: ScreenUtil().setWidth(15), - activeSize: ScreenUtil().setWidth(25), - space: ScreenUtil().setWidth(10), + size: 15.w, + activeSize: 25.w, + space: 10.w, ), ), autoplayDelay: 5000, diff --git a/lib/pages/market/market_detail_page/widget/market_details_app_bar.dart b/lib/pages/market/market_detail_page/widget/market_details_app_bar.dart index 489b33cb..e5672794 100644 --- a/lib/pages/market/market_detail_page/widget/market_details_app_bar.dart +++ b/lib/pages/market/market_detail_page/widget/market_details_app_bar.dart @@ -88,8 +88,7 @@ class _MarketDetailsAppBarState extends State { crossAxisCount: 3, mainAxisSpacing: 20.w, crossAxisSpacing: 30.w, - childAspectRatio: - 192.w / 58.w), + childAspectRatio: 192.w / 58.w), ), ), ), @@ -142,8 +141,7 @@ class _MarketDetailsAppBarState extends State { children: [ Text( widget.title, - style: TextStyle( - fontSize: 32.sp, color: Color(0xff333333)), + style: TextStyle(fontSize: 32.sp, color: Color(0xff333333)), ), SizedBox(width: 10.w), Container( @@ -170,7 +168,7 @@ class _MarketDetailsAppBarState extends State { ], // bottom: TabBar( // controller: _controller, - // labelPadding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(15)), + // labelPadding: EdgeInsets.symmetric(horizontal: 15.w), // indicator: BoxDecoration(), // isScrollable: true, // unselectedLabelStyle: TextStyle( @@ -185,16 +183,16 @@ class _MarketDetailsAppBarState extends State { // tabs: List.generate( // treeList.length, // (index) => Container( - // padding: EdgeInsets.symmetric(vertical:ScreenUtil().setWidth(32)), + // padding: EdgeInsets.symmetric(vertical:32.w), // child: Column( // children: [ // Image.asset( // treeList[index]['imagePath'], - // height: ScreenUtil().setWidth(110), - // width: ScreenUtil().setWidth(110), + // height: 110.w, + // width: 110.w, // fit: BoxFit.fill, // ), - // SizedBox(height: ScreenUtil().setWidth(14)), + // SizedBox(height: 14.w), // Text(treeList[index]['name']) // ], // ), diff --git a/lib/pages/market/market_page.dart b/lib/pages/market/market_page.dart index b727e7bc..b2fbecb3 100644 --- a/lib/pages/market/market_page.dart +++ b/lib/pages/market/market_page.dart @@ -65,7 +65,7 @@ class _MarketPageState extends State @override Widget build(BuildContext context) { - // double _appBarHeight = ScreenUtil().setHeight(506); + // double _appBarHeight = 506.w; super.build(context); return Scaffold( appBar: AppBar( @@ -73,8 +73,8 @@ class _MarketPageState extends State backgroundColor: Color(0xfff9f9f9), title: Container( padding: EdgeInsets.symmetric( - horizontal: ScreenUtil().setWidth(24), - vertical: ScreenUtil().setHeight(12), + horizontal: 24.w, + vertical: 12.w, ), decoration: BoxDecoration( color: Colors.white, diff --git a/lib/utils/screenutil.dart b/lib/utils/screenutil.dart index 39cd4833..b51af6bc 100644 --- a/lib/utils/screenutil.dart +++ b/lib/utils/screenutil.dart @@ -1,7 +1 @@ export 'package:flutter_screenutil/flutter_screenutil.dart'; - -// class Screenutil { -// static double length(double lengthNum) => ScreenUtil().setWidth(lengthNum); - -// static double size(double sizeNum) => ScreenUtil().setSp(sizeNum); -// } diff --git a/lib/widget/container_comment.dart b/lib/widget/container_comment.dart index a063eb1d..0038d6d8 100644 --- a/lib/widget/container_comment.dart +++ b/lib/widget/container_comment.dart @@ -5,18 +5,19 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; class ContainerComment extends StatelessWidget { final Widget customWidget; final double radius; - ContainerComment({Key key, this.customWidget,this.radius = 0}) : super(key: key); + ContainerComment({Key key, this.customWidget, this.radius = 0}) + : super(key: key); @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.symmetric( - horizontal: ScreenUtil().setWidth(32), - vertical: ScreenUtil().setHeight(17), + horizontal: 32.w, + vertical: 17.w, ), padding: EdgeInsets.symmetric( - horizontal: ScreenUtil().setWidth(24), - vertical: ScreenUtil().setHeight(16), + horizontal: 24.w, + vertical: 16.w, ), alignment: Alignment.center, decoration: BoxDecoration( @@ -24,9 +25,10 @@ class ContainerComment extends StatelessWidget { borderRadius: BorderRadius.all(Radius.circular(radius)), boxShadow: [ BoxShadow( - color: Colors.grey.withOpacity(0.2), - offset: Offset(1.1, 1.1), - blurRadius: 10.0), + color: Colors.grey.withOpacity(0.2), + offset: Offset(1.1, 1.1), + blurRadius: 10.0, + ), ], ), child: customWidget, diff --git a/lib/widget/single_ad_space.dart b/lib/widget/single_ad_space.dart index 0f0bb3c6..e23723a7 100644 --- a/lib/widget/single_ad_space.dart +++ b/lib/widget/single_ad_space.dart @@ -5,15 +5,15 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; class SingleAdSpace extends StatelessWidget { final String imagePath; final double radius; - SingleAdSpace({Key key,this.imagePath,this.radius = 0}) : super(key: key); + SingleAdSpace({Key key, this.imagePath, this.radius = 0}) : super(key: key); @override Widget build(BuildContext context) { return Container( - height: ScreenUtil().setHeight(160), + height: 160.w, margin: EdgeInsets.symmetric( - horizontal: ScreenUtil().setWidth(32), - vertical: ScreenUtil().setHeight(17), + horizontal: 32.w, + vertical: 17.w, ), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(radius)), @@ -29,7 +29,7 @@ class SingleAdSpace extends StatelessWidget { child: Container( child: Image.asset( imagePath, - height: ScreenUtil().setHeight(160), + height: 160.w, fit: BoxFit.fill, ), ),