MVVM => MWPP
Model、Widgets、Pages、Provides
Widget 相当于各个UIKit中的小组件,如UILabel、UIButton等,然后组合成一个大的View(Widget),再放入Controller(Page)中,通过Provide(ViewModel)进行不同组件间的通信(数据共享)。
class GoodsListGridTile extends MaterialWidgets {
GoodsItem item;
build: (context){
return Container(
padding: EdgeInsets.all(10),
child: Column(
children: <Widgets>[
_goodsImage(),
_goodsTitle(),
_goodsPrice(),
_goodsTags()
]
)
);
}
// 商品标签
Widget _goodsTags()
{
return Container(
margin: EdgeInsets.only(top: 5)
child: Text(
'${item.tags}',
style: TextStyle(
fontSize: 11
)
);
}
// 商品价格
Widget _goodsPrice()
{
return Container(
margin: EdgeInsets.only(top:5)
child: Row(
children: [
Text(
'${item.salePrice}',
style: TextStyle(
fontSize: 16
),
),
Text(
'${item.originPrice}',
style: TextStyle(
fontSize: 13
),
)
]
)
);
}
// 商品标题
Widget _goodsTitle()
{
return Container(
margin: EdgeInsets.only(top:5)
child: Text(
'${item.goodsTitle}',
style: TextStyle(
fontSize: 16
),
)
);
}
// 商品图
Widget _goodsImage()
{
// 封面图
Widget _goodsImage = Image.network(item.goodsImageUrl);
// 已售罄
Widget _soldOutCover = Image('soldout.png');
if(item.isSoldOut){
return Stack(
_goodsImage,
_soldOutCover,
);
}
return _goodsImage;
}
}
- lib
- pages
- home_page.dart
- home_pages
- home_banner_detail_page.dart // 轮播图详情
- home_category_detail_page.dart // 分类h5详情
- home_goods_detail_page.dart // 商品详情
- home_integral_page.dart // 积分中心
- home_flashsale_page.dart // 限时抢购
- home_assemble_page.dart // 拼团商品
- home_bargain_page.dart // 砍价
- home_trial_page.dart //试用
- home_cat_column_page.dart //喵专区
- home_dog_column_page.dart //狗子专区
- category_page.dart
- category_pages
- shopcart_page.dart
- shopcart_pages
- mine_page.dart
- mine_pages
- assets
- images
- htmls
- jsons
- videos
- audos
- gifs
- fonts
- models
- home_model.dart
- goods_model.dart
- goods_detail_model.dart
- user_model.dart
- account_model.dart
- services
- routes //flutter navigation routes
- network //environments、urls、methods
- provides
- persistent //data persistence class
- widgets
- customs //app related
- PTDimensions.dart
- PTIcons.dart
- PTImages.dart
- PTResources.dart
- foundations //base foundation
- PTApplication
- PTNetwork
- PTDevice.dart
- PTJSON.dart
- PTFont.dart
- PTColors.dart
- uikits // ui widget kit
- PTBasePage.dart
- PTListView.dart
- PTGridView.dart
- PTToast.dart
- PTDialog.dart
- PTPannel.dart
- PTHUD.dart
- PTIconButton.dart
- PTImageView.dart
- customs
- goods_list_grid_tile.dart
- goods_list_slip_tile.dart
- customs //app related
- pages
网友评论