import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/item_title.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class FeaturedActivity extends StatefulWidget { @override State createState() { return _FeaturedActivity(); } } class _FeaturedActivity extends State { @override Widget build(BuildContext context) { return Column( children: [ ItemTitle( text: S.of(context).jifenshangcheng, imgPath: "assets/image/icon_points_mall.png", moreText: S.of(context).chakangengduo, onTap: () {}, ), SizedBox( height: 10.h, ), Container( margin: EdgeInsets.symmetric(horizontal: 11.w), child: Row( children: [ Container( child: stackItem(18.sp), margin: EdgeInsets.symmetric(horizontal: 5.w), width: (MediaQuery.of(context).size.width - 42) / 2, height: 180.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: Colors.red, image: DecorationImage( image: AssetImage( "assets/image/share_image_bg.png", ), fit: BoxFit.cover, ), ), ), Container( child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( child: stackItem(14.sp), margin: EdgeInsets.symmetric(horizontal: 5.w), width: (MediaQuery.of(context).size.width - 42) / 2, height: 170.h / 2, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: Colors.green, image: DecorationImage( image: AssetImage( "assets/image/share_image_bg.png", ), fit: BoxFit.cover, ), ), ), SizedBox( height: 10.h, ), Container( child: stackItem(14.sp), margin: EdgeInsets.symmetric(horizontal: 5.w), width: (MediaQuery.of(context).size.width - 42) / 2, height: 170.h / 2, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: Colors.blue, image: DecorationImage( image: AssetImage( "assets/image/share_image_bg.png", ), fit: BoxFit.cover, ), ), ), ], ), ), ], ), ), SizedBox( height: 28.h, ), ], ); } Widget stackItem(double textSize) { return Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( margin: EdgeInsets.only(left: 8, top: 8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "第二件半价!", style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: textSize, color: Colors.white, ), ), SizedBox( height: 2, ), Text( "仅限指定饮品", style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 12.sp, color: Colors.white, ), ), ], ), ), Container( width: 58.w, margin: EdgeInsets.only(left: 8, bottom: 8), padding: EdgeInsets.symmetric( vertical: 4.h, horizontal: 8.w, ), decoration: BoxDecoration( color: Color(0xFF32A060), borderRadius: BorderRadius.circular(20), ), alignment: Alignment.center, child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( "了解", style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.medium, color: Colors.white, ), ), Icon( Icons.keyboard_arrow_right, color: Colors.white, size: 12, ), ], ), ), ], ); } }