Untitled
unknown
dart
2 years ago
4.7 kB
6
Indexable
class MyProductScreen extends StatelessWidget { const MyProductScreen({super.key}); @override Widget build(BuildContext context) { return BlocProvider<CategoriesBloc>( create: (context) { final repository = RepositoryProvider.of<CategoryRepository>(context); return CategoriesBloc(repository)..add(LoadCategories()); }, child: const MyProductScreenContent(), ); } } class MyProductScreenContent extends StatelessWidget { const MyProductScreenContent({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text("Produk Saya"), centerTitle: true, ), body: SafeArea( bottom: true, child: SizedBox( width: double.infinity, child: SingleChildScrollView( physics: const ClampingScrollPhysics(), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ 16.height, Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: SizedBox(height: 49, child: _searchTextField(context)), ), 8.height, const CategorySection(), const Divider( height: 3, color: AppColors.gray4Color, ), 16.height, Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), decoration: BoxDecoration( border: Border.all(color: AppColors.yellowColor, width: 1), borderRadius: BorderRadius.circular(8), color: AppColors.lightYellowColor), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ SvgPicture.asset( CMSIcons.grocery, width: 32, fit: BoxFit.scaleDown, ), 20.width, const Expanded( child: CMSText( "Beli produk termurah hanya disini!", style: main14SemiBold, ), ), ], ), ), ), 24.height, const Padding( padding: EdgeInsets.symmetric(horizontal: 24), child: CMSText("Gudang Terdekat", style: main16SemiBold), ), Padding( padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16), child: ListView.builder( shrinkWrap: true, scrollDirection: Axis.vertical, physics: const NeverScrollableScrollPhysics(), itemCount: 10, itemBuilder: ((context, index) { return const Padding( padding: EdgeInsets.only(bottom: 16), child: CMSWarehouseCard(), ); })), ), ], ), ), ), ), ); } TextFormField _searchTextField(BuildContext context) { return TextFormField( readOnly: true, style: const TextStyle( height: 1.5, fontWeight: FontWeight.w500, fontSize: 13, ), textAlignVertical: TextAlignVertical.center, decoration: InputDecoration( hintText: "Cari Produk", hintStyle: const TextStyle( height: 1.5, fontWeight: FontWeight.w500, fontSize: 13, color: Color(0xFFC9C7C7), ), contentPadding: const EdgeInsets.fromLTRB( 0, 0, 0, 0, ), border: const OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(6), ), ), prefixIcon: Image.asset( CMSIcons.search, width: 18, height: 18, ), ), onTap: () => Navigator.pushNamed(context, Routes.searchProduct), ); } }
Editor is loading...