diff --git a/fair_templates/images/appbar.png b/fair_templates/images/appbar.png new file mode 100644 index 00000000..e82b08dd Binary files /dev/null and b/fair_templates/images/appbar.png differ diff --git a/templates/component/custom_scrollview/cover_custom_scrollview_small.png b/fair_templates/images/custom_scrollview.png similarity index 100% rename from templates/component/custom_scrollview/cover_custom_scrollview_small.png rename to fair_templates/images/custom_scrollview.png diff --git a/fair_templates/images/detail_page.png b/fair_templates/images/detail_page.png new file mode 100644 index 00000000..1eaa921f Binary files /dev/null and b/fair_templates/images/detail_page.png differ diff --git a/fair_templates/images/drawer.png b/fair_templates/images/drawer.png new file mode 100644 index 00000000..2ec9127f Binary files /dev/null and b/fair_templates/images/drawer.png differ diff --git a/fair_templates/images/fab.png b/fair_templates/images/fab.png new file mode 100644 index 00000000..1a7893dc Binary files /dev/null and b/fair_templates/images/fab.png differ diff --git a/templates/component/gridview/cover_gridview_small.png b/fair_templates/images/gridview.png similarity index 100% rename from templates/component/gridview/cover_gridview_small.png rename to fair_templates/images/gridview.png diff --git a/fair_templates/images/list_card.png b/fair_templates/images/list_card.png new file mode 100644 index 00000000..9d9d370b Binary files /dev/null and b/fair_templates/images/list_card.png differ diff --git a/fair_templates/images/list_page.png b/fair_templates/images/list_page.png new file mode 100644 index 00000000..91b2d37a Binary files /dev/null and b/fair_templates/images/list_page.png differ diff --git a/templates/component/listview/cover_listview_small.png b/fair_templates/images/listview.png similarity index 100% rename from templates/component/listview/cover_listview_small.png rename to fair_templates/images/listview.png diff --git a/fair_templates/images/login_page.png b/fair_templates/images/login_page.png new file mode 100644 index 00000000..4801edd6 Binary files /dev/null and b/fair_templates/images/login_page.png differ diff --git a/templates/component/pageview/cover_pageview_small.png b/fair_templates/images/pageview.png similarity index 100% rename from templates/component/pageview/cover_pageview_small.png rename to fair_templates/images/pageview.png diff --git a/fair_templates/images/popupmenubutton.png b/fair_templates/images/popupmenubutton.png new file mode 100644 index 00000000..eb4b6898 Binary files /dev/null and b/fair_templates/images/popupmenubutton.png differ diff --git a/templates/component/staggeredview/cover_staggeredview_small.png b/fair_templates/images/staggeredview.png similarity index 100% rename from templates/component/staggeredview/cover_staggeredview_small.png rename to fair_templates/images/staggeredview.png diff --git a/fair_templates/images/tabbar.png b/fair_templates/images/tabbar.png new file mode 100644 index 00000000..0b6aa70a Binary files /dev/null and b/fair_templates/images/tabbar.png differ diff --git a/templates/component/custom_scrollview/standard/home_scrollview.dart b/fair_templates/templates/component/custom_scrollview/standard/home_scrollview.dart similarity index 100% rename from templates/component/custom_scrollview/standard/home_scrollview.dart rename to fair_templates/templates/component/custom_scrollview/standard/home_scrollview.dart diff --git a/templates/component/gridview/standard/gridview_template.dart b/fair_templates/templates/component/gridview/standard/gridview_template.dart similarity index 100% rename from templates/component/gridview/standard/gridview_template.dart rename to fair_templates/templates/component/gridview/standard/gridview_template.dart diff --git a/templates/component/listview/datasource/fair_test_data.dart b/fair_templates/templates/component/listview/datasource/fair_test_data.dart similarity index 100% rename from templates/component/listview/datasource/fair_test_data.dart rename to fair_templates/templates/component/listview/datasource/fair_test_data.dart diff --git a/templates/component/listview/standard/hotel_listview.dart b/fair_templates/templates/component/listview/standard/hotel_listview.dart similarity index 100% rename from templates/component/listview/standard/hotel_listview.dart rename to fair_templates/templates/component/listview/standard/hotel_listview.dart diff --git a/templates/component/listview/standard/hotel_listview_item.dart b/fair_templates/templates/component/listview/standard/hotel_listview_item.dart similarity index 100% rename from templates/component/listview/standard/hotel_listview_item.dart rename to fair_templates/templates/component/listview/standard/hotel_listview_item.dart diff --git a/templates/component/pageview/datasource/fair_test_data.dart b/fair_templates/templates/component/pageview/datasource/fair_test_data.dart similarity index 100% rename from templates/component/pageview/datasource/fair_test_data.dart rename to fair_templates/templates/component/pageview/datasource/fair_test_data.dart diff --git a/templates/component/pageview/standard/pageview_template.dart b/fair_templates/templates/component/pageview/standard/pageview_template.dart similarity index 100% rename from templates/component/pageview/standard/pageview_template.dart rename to fair_templates/templates/component/pageview/standard/pageview_template.dart diff --git a/templates/component/pageview/standard/pageview_template_item.dart b/fair_templates/templates/component/pageview/standard/pageview_template_item.dart similarity index 100% rename from templates/component/pageview/standard/pageview_template_item.dart rename to fair_templates/templates/component/pageview/standard/pageview_template_item.dart diff --git a/templates/component/staggeredview/datasource/fair_test_data.dart b/fair_templates/templates/component/staggeredview/datasource/fair_test_data.dart similarity index 100% rename from templates/component/staggeredview/datasource/fair_test_data.dart rename to fair_templates/templates/component/staggeredview/datasource/fair_test_data.dart diff --git a/templates/component/staggeredview/standard/staggeredview_template.dart b/fair_templates/templates/component/staggeredview/standard/staggeredview_template.dart similarity index 100% rename from templates/component/staggeredview/standard/staggeredview_template.dart rename to fair_templates/templates/component/staggeredview/standard/staggeredview_template.dart diff --git a/templates/component/staggeredview/standard/staggeredview_template_item.dart b/fair_templates/templates/component/staggeredview/standard/staggeredview_template_item.dart similarity index 100% rename from templates/component/staggeredview/standard/staggeredview_template_item.dart rename to fair_templates/templates/component/staggeredview/standard/staggeredview_template_item.dart diff --git a/fair_templates/templates/page/detail_page/fair_detail.dart b/fair_templates/templates/page/detail_page/fair_detail.dart new file mode 100644 index 00000000..116df7db --- /dev/null +++ b/fair_templates/templates/page/detail_page/fair_detail.dart @@ -0,0 +1,208 @@ +import 'package:flutter/material.dart'; +import 'package:fair/fair.dart'; + +@FairPatch() +class FairDetail extends StatefulWidget { + final dynamic fairProps; + + const FairDetail({Key? key, this.fairProps}) : super(key: key); + + @override + State createState() => _FairDetailState(); +} + +class _FairDetailState extends State { + @FairProps() + var fairProps; + + @override + void initState() { + super.initState(); + fairProps = widget.fairProps; + } + + /// 顶部widget + Widget _topWidget() { + return Stack( + children: [ + Container( + child: Image.network('https://pic3.58cdn.com.cn/nowater/frs/n_v327380fe3313c44cb8528c6a7b5fb501c.jpg'), + ), + Positioned( + top: 20, + child: Container( + height: 72, + width: 66, + child: Image.network('https://pic3.58cdn.com.cn/nowater/frs/n_v378fb424b4182441a9f743c44336ea9f5.png'), + ), + ) + ], + ); + } + + /// 概要widget + Widget _outlineWidget() { + return Padding( + padding: EdgeInsets.fromLTRB(20, 25, 20, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _getAuth(), + style: TextStyle( + color: Color(0xFF3978C4), + fontWeight: FontWeight.w500, + fontSize: 15, + ), + ), + Padding( + padding: EdgeInsets.fromLTRB(0, 15, 0, 0), + child: Text( + _getTitle(), + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + Padding( + padding: EdgeInsets.fromLTRB(0, 10, 0, 0), + child: Text( + _getDes(), + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.grey, + fontWeight: FontWeight.w400, + fontSize: 14, + ), + ), + ), + ], + ), + ); + } + + /// 时间&地点 + Widget _timeAndLocation() { + return Padding( + padding: EdgeInsets.fromLTRB(20, 15, 20, 0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + width: 20, + height: 20, + child: Image.network('https://pic7.58cdn.com.cn/nowater/frs/n_v37e6d7991117d417eac9b0214dbc3fb34.png'), + ), + Padding( + padding: EdgeInsets.only(left: 5), + child: Text( + _getTime(), + style: TextStyle( + fontSize: 15, + color: Color(0xFF3978C4), + ), + maxLines: 1, + ), + ), + Padding( + padding: EdgeInsets.only(left: 30), + child: Container( + width: 26, + height: 20, + child: Image.network('https://pic5.58cdn.com.cn/nowater/frs/n_v3df9d125924c84b129515973e617aebe1.png'), + ), + ), + Expanded( + child: Text( + _getLocation(), + style: TextStyle(color: Color(0xFF3978C4)), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + ); + } + + Widget _DetailTitle() { + return Padding( + padding: EdgeInsets.fromLTRB(20, 25, 20, 0), + child: Text( + 'Event Details', + style: TextStyle( + color: Colors.grey, fontSize: 14, fontWeight: FontWeight.w500), + ), + ); + } + + /// 详细信息 + Widget _information() { + return Padding( + padding: EdgeInsets.fromLTRB(20, 10, 20, 0), + child: Text( + _getDetailContent(), + style: TextStyle( + color: Color(0xFF121416), + fontSize: 15, + fontWeight: FontWeight.w500), + ), + ); + } + + String _getAuth() { + return fairProps['auth']; + } + + String _getTitle() { + return fairProps['title']; + } + + String _getDes() { + return fairProps['des']; + } + + String _getTime() { + return fairProps['time']; + } + + String _getLocation() { + return fairProps['location']; + } + + String _getDetailContent() { + return fairProps['detail']; + } + + void _onPress(){ + print('onPressed'); + } + + @override + Widget build(BuildContext context) { + return Scaffold( +// floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, + floatingActionButton: Container( + width: Sugar.width(context), + height: 45, + margin: EdgeInsets.fromLTRB(50, 0, 50, 15), + child: ElevatedButton( + onPressed:_onPress, + child: Text('RSVP to Event'), + ), + ), + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _topWidget(), + _outlineWidget(), + _timeAndLocation(), + _DetailTitle(), + _information(), + ], + ), + ); + } +} diff --git a/fair_templates/templates/page/list_card/list_card_item.dart b/fair_templates/templates/page/list_card/list_card_item.dart new file mode 100644 index 00000000..be79033b --- /dev/null +++ b/fair_templates/templates/page/list_card/list_card_item.dart @@ -0,0 +1,129 @@ +import 'package:fair/fair.dart'; +import 'package:flutter/material.dart'; + +@FairPatch() +class ListCardItem extends StatefulWidget { + const ListCardItem({Key? key}) : super(key: key); + + @override + State createState() => _ListCardItemState(); +} + +class _ListCardItemState extends State { + @override + Widget build(BuildContext context) { + return Container( + child: Padding( + padding: EdgeInsets.fromLTRB(20, 10, 20, 20), + child: Column( + children: [ + Row( + children: [ + Expanded( + child: Row( + children: [ + CircleAvatar( + radius: 30, + backgroundImage: NetworkImage( + 'http://c-ssl.duitang.com/uploads/item/202003/26/20200326223552_nayyt.jpeg'), + ), + SizedBox( + width: 20, + ), + Text( + '贝贝', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + decoration: TextDecoration.none, + color: Colors.black), + ) + ], + )), + Container( + width: 30, + height: 30, + child: Image.network('https://pic6.58cdn.com.cn/nowater/frs/n_v33db8caaa95cc4d1eb9426e9b991bed34.png'), + ) + ], + ), + Padding( + padding: EdgeInsets.fromLTRB(10, 10, 10, 10), + child: Row( + children: [ + Expanded( + child: Text( + '换个头像换个心情😊', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + decoration: TextDecoration.none, + color: Colors.black), + )) + ], + ), + ), + Card( + child: Image( + image: NetworkImage( + 'https://img2.baidu.com/it/u=4114138728,2649938841&fm=253&fmt=auto&app=138&f=JPEG'), + ), + ), + Padding( + padding: EdgeInsets.fromLTRB(10, 10, 10, 10), + child: Row( + children: [ + Expanded( + child: Row( + children: [ + SizedBox( + width: 30, + height: 30, + child: Image.network('https://pic7.58cdn.com.cn/nowater/frs/n_v35812c5fc830e49d991d5e17633729392.png'), + ), + SizedBox( + width: 15, + ), + Text( + '125', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + decoration: TextDecoration.none, + color: Colors.black54), + ), + SizedBox( + width: 30, + ), + SizedBox( + width: 30, + height: 30, + child: Image.network('https://pic4.58cdn.com.cn/nowater/frs/n_v3c264a2d3f9864ecabd8f05ee944ccafe.png'), + ), + SizedBox( + width: 15, + ), + Text( + '66', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + decoration: TextDecoration.none, + color: Colors.black54), + ), + ], + )), + SizedBox( + width: 30, + height: 30, + child: Image.network('https://pic7.58cdn.com.cn/nowater/frs/n_v33e401d24fa6f44a1ac7a7d3319eef7e6.png'), + ) + ], + ), + ) + ], + ), + ), + ); + } +} diff --git a/fair_templates/templates/page/list_card/moments_list.dart b/fair_templates/templates/page/list_card/moments_list.dart new file mode 100644 index 00000000..56f3fa0a --- /dev/null +++ b/fair_templates/templates/page/list_card/moments_list.dart @@ -0,0 +1,67 @@ +import 'package:fair/fair.dart'; +import 'package:flutter/material.dart'; + +@FairPatch() +class MomentsList extends StatefulWidget { + const MomentsList({Key? key}) : super(key: key); + + @override + State createState() => _MomentsListState(); +} + +class _MomentsListState extends State { + @override + Widget build(BuildContext context) { + return Container( + child: NestedScrollView( + headerSliverBuilder: Sugar.isNestedScrollViewHeaderSliversBuilder( + context: context, + innerBoxIsScrolled: false, + headerSliverBuilder: [SliverAppBar( + pinned: true, + stretch: true, + expandedHeight: 200, + snap: false, + elevation: 0, + backgroundColor: Colors.white, + leading: IconButton( + icon: Image.network( + 'https://pic3.58cdn.com.cn/nowater/frs/n_v30298bfe0255a4f42a38399e559dadd1e.png', + height: 22, + width: 22, + ), + onPressed: (()=>{}), + ), + flexibleSpace: FlexibleSpaceBar( + title: Row(children: [Padding(padding: EdgeInsets.fromLTRB(50, 10, 10, 2),child: Text( + '欢迎来到妮妮朋友圈', + style: TextStyle( + color: Color(0xFF333333), + fontWeight: FontWeight.w700, + fontSize: 17, + ), + ),)],), + //标题居中 + centerTitle: true, + background: Image.network( + 'https://img1.baidu.com/it/u=1500716295,3279382336&fm=253&fmt=auto&app=120&f=JPEG', + fit: BoxFit.fill, + ), + ), + )]), + body: Container( + color: Colors.white, + child: Sugar.listBuilder( + itemCount: 5, + itemBuilder: (context, index) { + return FairWidget( + name: 'itme', + path: 'assets/fair/lib_template_list_card_list_card_item.fair.json', + data: const {'': ''}); + }), + ), + ), + ); + } +} + diff --git a/fair_templates/templates/page/list_page/list_page.dart b/fair_templates/templates/page/list_page/list_page.dart new file mode 100644 index 00000000..48c6fcd5 --- /dev/null +++ b/fair_templates/templates/page/list_page/list_page.dart @@ -0,0 +1,64 @@ +import 'package:fair/fair.dart'; +import 'package:flutter/material.dart'; + +@FairPatch() +class ListDemoPage extends StatefulWidget { + const ListDemoPage({Key? key}) : super(key: key); + + @override + State createState() => _ListDemoPageState(); +} + +class _ListDemoPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 0, + backgroundColor: Colors.white, + shadowColor: Colors.white, + bottom: PreferredSize( + preferredSize: Size(Sugar.width(context), 44), + child: const Material( + color: Colors.white, + child: Padding( + padding: EdgeInsets.only(left: 15, right: 15, bottom: 5), + child: TextField( + controller: null, + decoration: InputDecoration( + prefixIcon: Icon(Icons.search), + suffixIcon: Icon(Icons.settings_input_component), + contentPadding: EdgeInsets.only(top: 0, bottom: 0), + enabledBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.black12, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(10)), + ), + focusedBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.black12, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(10)), + ), + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.black12, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(10)), + )), + ), + ), + ), + )), + body: Container( + color: Colors.white, + child: Sugar.listBuilder( + itemCount: 5, + itemBuilder: (context, index) { + return FairWidget( + name: 'item', + path: 'assets/fair/lib_template_list_page_list_item.fair.json', + data: const {'': ''}); + }), + ), + ); + } +} diff --git a/fair_templates/templates/page/login_page/login_page_template.dart b/fair_templates/templates/page/login_page/login_page_template.dart new file mode 100644 index 00000000..00bb21ee --- /dev/null +++ b/fair_templates/templates/page/login_page/login_page_template.dart @@ -0,0 +1,149 @@ +import 'package:fair/fair.dart'; +import 'package:flutter/material.dart'; + +@FairPatch() +class LoginPage extends StatefulWidget { + const LoginPage({Key? key}) : super(key: key); + + @override + State createState() => _LoginPageState(); +} + +class _LoginPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + body: Container( + decoration: const BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: NetworkImage('https://pic3.58cdn.com.cn/nowater/frs/n_v3d3d6d8fe3a6a4212b8d40aca6b343012.jpg'), + ), + ), + child: Column( + children: [ + Container( + margin: const EdgeInsets.only(top: 50), + child: Image.network( + 'https://pic1.58cdn.com.cn/nowater/frs/n_v3862a7fea83c746b78a46a16e00812310.png', + height: 50, + width: 50, + ), + ), + Container( + margin: const EdgeInsets.only(top: 20), + child: const Text( + '登录页', + style: TextStyle( + color: Colors.white, + fontSize: 25, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: const EdgeInsets.only(left: 20, right: 20, top: 20), + padding: const EdgeInsets.symmetric(horizontal: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + ), + child: const TextField( + decoration: InputDecoration( + border: InputBorder.none, + hintText: 'Email Address', + contentPadding: EdgeInsets.symmetric(vertical: 20), + ), + ), + ), + Container( + margin: const EdgeInsets.only(left: 20, right: 20, top: 10), + padding: const EdgeInsets.symmetric(horizontal: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + ), + child: const TextField( + obscureText: true, + decoration: InputDecoration( + border: InputBorder.none, + hintText: 'Password', + contentPadding: EdgeInsets.symmetric(vertical: 20), + ), + ), + ), + Container( + decoration: BoxDecoration( + color: Colors.greenAccent, + borderRadius: BorderRadius.circular(8), + ), + margin: const EdgeInsets.only(left: 40, right: 40, top: 20), + alignment: Alignment.center, + height: 60, + child: const Text( + 'Login', + style: TextStyle( + fontSize: 16, + color: Colors.white, + ), + ), + ), + Container( + margin: const EdgeInsets.only(top: 30), + child: const Text( + 'Forget Password?', + style: TextStyle(fontSize: 18, color: Colors.white, fontWeight: FontWeight.bold), + ), + ), + Container( + margin: const EdgeInsets.only(top: 30), + child: Text( + 'Or use a social account to login', + style: TextStyle( + fontSize: 13, + color: Sugar.colorsWithOpacity(Colors.white, 0.8), + ), + ), + ), + Container( + margin: const EdgeInsets.only(top: 20), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Image.network( + 'https://pic8.58cdn.com.cn/nowater/frs/n_v3858e1e07b41147329939e41903a444cc.png', + height: 50, + width: 50, + fit: BoxFit.cover, + ), + const SizedBox(width: 10,), + Image.network( + 'https://pic5.58cdn.com.cn/nowater/frs/n_v3d139c179b97946458a1abd1d9598659f.png', + height: 50, + width: 50, + fit: BoxFit.cover, + ), + const SizedBox(width: 10,), + Image.network( + 'https://pic2.58cdn.com.cn/nowater/frs/n_v3730125696e36437da2921e8506477bf8.png', + height: 50, + width: 50, + fit: BoxFit.cover, + ), + const SizedBox(width: 10,), + Image.network( + 'https://pic4.58cdn.com.cn/nowater/frs/n_v37cda806f6e7448089b880888447f89c8.png', + height: 50, + width: 50, + fit: BoxFit.cover, + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/fair_templates/templates/page/tabbar/tabbar_page.dart b/fair_templates/templates/page/tabbar/tabbar_page.dart new file mode 100644 index 00000000..37b2652b --- /dev/null +++ b/fair_templates/templates/page/tabbar/tabbar_page.dart @@ -0,0 +1,139 @@ +import 'dart:core'; + +import 'package:fair/fair.dart'; +import 'package:flutter/material.dart'; + +@FairPatch() +class SugarTabBarPage extends StatefulWidget { + final dynamic fairProps; + + SugarTabBarPage({Key? key, required this.fairProps}) : super(key: key); + + @override + State createState() => _SugarTabBarPageState(); +} + +class _SugarTabBarPageState extends State { + @FairProps() + late List fairProps; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return DefaultTabController( + initialIndex: 1, + length: 3, + child: Scaffold( + appBar: AppBar( + title: Text('Fair TabBar'), + automaticallyImplyLeading: false, // 隐藏左侧按钮 + actions: [ + IconButton(onPressed: Sugar.onTapEmpty(), icon: Icon(Icons.search)), + ], + bottom: const TabBar( + tabs: [ + Tab( + child: Text('All', style: TextStyle(fontSize: 20)), + ), + Tab( + child: Text('Active', style: TextStyle(fontSize: 20)), + ), + Tab( + child: Text('Inactive', style: TextStyle(fontSize: 20)), + ), + ], + ), + ), + body: TabBarView( + children: [ + _allTabList(), + ListView.builder( + itemBuilder: _itemBuilder, + itemCount: 3, + ), + _allTabList(), + ], + ), + ), + ); + } + + /// All && Inactive customScrollView + Widget _allTabList() { + return Container( + color: Colors.grey[400], + child: CustomScrollView( + slivers: [ + SliverList( + delegate: Sugar.sliverChildBuilderDelegate( + builder: (content, index) { + return Container( + height: 140, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(15)), + color: Colors.white, + ), + // clipBehavior: Clip.hardEdge, + // color: Colors.amber, + margin: EdgeInsets.only(left: 20, right: 20, top: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Container( + width: 120, + height: 120, + padding: EdgeInsets.all(10), + child: ClipRRect( + borderRadius: BorderRadius.circular(15), + child: Image.network( + 'https://gd-hbimg.huaban.com/bb8f4ae6711528dc754799afe6b95d438481265d245ac-ROmreT_fw658', + fit: BoxFit.cover), + )), + Container( + padding: EdgeInsets.all(10), + // color: Colors.blue, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('$index', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold)), + Text('SubTitle-SubTitle'), + ], + ), + ), + ], + ), + Container( + padding: EdgeInsets.only(right: 10), + child: Icon(Icons.radio_button_on_outlined), + ) + ], + ), + ), + ); + }, + childCount: 3, //findChildIndexCallback + ), + ), + ], + ), + ); + } + + /// Active 假动作 ListView.builder + Widget _itemBuilder(context, index) { + return Center( + child: Text("It's _activeItemBuilder here"), + ); + } +} diff --git a/fair_templates/templates/page/tabbar/tabbar_page_item.dart b/fair_templates/templates/page/tabbar/tabbar_page_item.dart new file mode 100644 index 00000000..91800831 --- /dev/null +++ b/fair_templates/templates/page/tabbar/tabbar_page_item.dart @@ -0,0 +1,73 @@ +import 'package:fair/fair.dart'; +import 'package:flutter/material.dart'; + +@FairPatch() +class SugarTabBarItem extends StatefulWidget { + dynamic fairProps; + + SugarTabBarItem({Key? key, required this.fairProps}) : super(key: key); + + @override + State createState() => _SugarTabBarItemState(); +} + +class _SugarTabBarItemState extends State { + @FairProps() + var fairProps; + + String _getImagePath() { + return fairProps['imageUrl']; + } + + String _getTitle() { + return fairProps['title']; + } + + @override + Widget build(BuildContext context) { + return Container( + height: 140, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(15)), + color: Colors.white, + ), + margin: EdgeInsets.only(left: 20, right: 20, top: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Container( + width: 120, + height: 120, + padding: EdgeInsets.all(10), + child: ClipRRect( + borderRadius: BorderRadius.circular(15), + child: Image.network(_getImagePath(), fit: BoxFit.cover), + )), + Container( + padding: EdgeInsets.all(10), + // color: Colors.blue, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text(_getTitle(), + style: TextStyle( + fontSize: 16, fontWeight: FontWeight.bold)), + SizedBox( + height: 10, + ), + Text('SubTitle-SubTitle'), + ], + ), + ), + ], + ), + ], + ), + ), + ); + } +} diff --git a/fair_templates/templates/widget/appbar/appbar_template.dart b/fair_templates/templates/widget/appbar/appbar_template.dart new file mode 100644 index 00000000..66ba0958 --- /dev/null +++ b/fair_templates/templates/widget/appbar/appbar_template.dart @@ -0,0 +1,28 @@ +import 'package:fair/fair.dart'; +import 'package:flutter/material.dart'; + +@FairPatch() +class AppBarTemplate extends StatefulWidget { + const AppBarTemplate({Key? key}) : super(key: key); + + @override + State createState() => _AppBarTemplateState(); +} + +class _AppBarTemplateState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + leading: const BackButton(), + title: const Text('AppBar'), + centerTitle: true, + toolbarHeight: 55, + primary: true, + backgroundColor: Colors.blue, + toolbarOpacity: 1, + actions: [], + ), + ); + } +} diff --git a/fair_templates/templates/widget/drawer/drawer_template.dart b/fair_templates/templates/widget/drawer/drawer_template.dart new file mode 100644 index 00000000..c3d13d49 --- /dev/null +++ b/fair_templates/templates/widget/drawer/drawer_template.dart @@ -0,0 +1,57 @@ +import 'package:fair/fair.dart'; +import 'package:flutter/material.dart'; + +@FairPatch() +class DrawerTemplate extends StatefulWidget { + const DrawerTemplate({Key? key}) : super(key: key); + + @override + State createState() => _DrawerTemplateState(); +} + +class _DrawerTemplateState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Drawer'), + ), + drawer: Drawer( + child: ListView( + children: const [ + DrawerHeader( + decoration: BoxDecoration( + color: Colors.lightBlueAccent, + ), + child: Center( + child: SizedBox( + width: 80.0, + height: 80.0, + child: CircleAvatar( + child: Text('FAIR'), + ), + ), + ), + ), + ListTile( + leading: Icon(Icons.phone), + title: Text('电话'), + ), + ListTile( + leading: Icon(Icons.email), + title: Text('邮箱'), + ), + ListTile( + leading: Icon(Icons.pin_drop_sharp), + title: Text('位置'), + ), + ListTile( + leading: Icon(Icons.settings), + title: Text('设置'), + ), + ], + ), + ), + ); + } +} diff --git a/fair_templates/templates/widget/fab/fab_template.dart b/fair_templates/templates/widget/fab/fab_template.dart new file mode 100644 index 00000000..07b4732b --- /dev/null +++ b/fair_templates/templates/widget/fab/fab_template.dart @@ -0,0 +1,61 @@ +import 'package:fair/fair.dart'; +import 'package:flutter/material.dart'; + +@FairPatch() +class FabTemplate extends StatefulWidget { + const FabTemplate({Key? key}) : super(key: key); + + @override + State createState() => _FabTemplateState(); +} + + + +class _FabTemplateState extends State { + + int _counter = 0; + + void _incrementCounter() { + setState(() { + _counter++; + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + 'You have pushed the button this many times:', + ), + Text( + '$_counter', + // 暂不支持 style: Theme.of(context).textTheme.headline4, + // 可替换成: + style: TextStyle(fontSize: 40, color: Color(0xffeb4237), wordSpacing: 0), + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + ///设置悬浮按钮的背景 + backgroundColor: Colors.blue, + ///获取焦点时显示的颜色 + focusColor: Colors.blueAccent, + ///鼠标悬浮在按钮上时显示的颜色 + hoverColor: Colors.lightBlue, + ///水波纹颜色 + splashColor: Colors.lightBlueAccent, + ///配制阴影高度 未点击时 + elevation: 0.0, + ///配制阴影高度 点击时 + highlightElevation: 20.0, + onPressed: _incrementCounter, + child: const Icon(Icons.add), + ), + ); + } +} diff --git a/templates/widget/popupmenubutton/popupmenubutton.dart b/fair_templates/templates/widget/popupmenubutton/popupmenubutton.dart similarity index 100% rename from templates/widget/popupmenubutton/popupmenubutton.dart rename to fair_templates/templates/widget/popupmenubutton/popupmenubutton.dart diff --git a/templates/page/list_page/list_page.dart b/templates/page/list_page/list_page.dart deleted file mode 100755 index 6d6ccc0a..00000000 --- a/templates/page/list_page/list_page.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:fish_redux/fish_redux.dart'; - -import '$prefix_effect.dart'; -import '$prefix_reducer.dart'; -import '$prefix_state.dart'; -import '$prefix_view.dart'; - -class $namePage extends Page<$nameState, Map> { - $namePage() - : super( - initState: initState, - effect: buildEffect(), - reducer: buildReducer(), - view: buildView, - dependencies: Dependencies<$nameState>( - adapter: null, - slots: >{ - }), - middleware: >[ - ],); - -}