diff --git a/.dart_tool/build_resolvers/sdk.sum b/.dart_tool/build_resolvers/sdk.sum
deleted file mode 100644
index a788675..0000000
Binary files a/.dart_tool/build_resolvers/sdk.sum and /dev/null differ
diff --git a/.dart_tool/build_resolvers/sdk.sum.deps b/.dart_tool/build_resolvers/sdk.sum.deps
deleted file mode 100644
index 1c10e44..0000000
--- a/.dart_tool/build_resolvers/sdk.sum.deps
+++ /dev/null
@@ -1 +0,0 @@
-{"sdk":"2.7.2 (Mon Mar 23 22:11:27 2020 +0100) on \"macos_x64\"","analyzer":"/Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/analyzer-0.39.14","build_resolvers":"/Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/build_resolvers-1.3.11"}
\ No newline at end of file
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index aea820a..8c1af58 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -770,7 +770,7 @@
"languageVersion": "2.1"
}
],
- "generated": "2020-09-21T02:27:30.928433Z",
+ "generated": "2020-09-22T07:54:03.242397Z",
"generator": "pub",
"generatorVersion": "2.7.2"
}
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
deleted file mode 100644
index a55e7a1..0000000
--- a/.idea/codeStyles/codeStyleConfig.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/saveactions_settings.xml b/.idea/saveactions_settings.xml
new file mode 100644
index 0000000..6025467
--- /dev/null
+++ b/.idea/saveactions_settings.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/pages/main_page/main_page.dart b/lib/pages/main_page/main_page.dart
index 04aecb5..392de7a 100644
--- a/lib/pages/main_page/main_page.dart
+++ b/lib/pages/main_page/main_page.dart
@@ -8,6 +8,7 @@ import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_notifier.
import 'package:zhiying_base_widget/widgets/others/mine_header_bg_widget.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
+import 'package:zhiying_base_widget/widgets/home/home_auth/home_auth.dart';
class MainPage extends StatefulWidget {
final Map data;
@@ -24,9 +25,7 @@ class MainPage extends StatefulWidget {
class _MainPageState extends State {
@override
Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Color(0xfff9f9f9),
- body: MultiProvider(
+ return MultiProvider(
providers: [
ChangeNotifierProvider.value(value: MainPageNotifier()),
ChangeNotifierProvider.value(value: MainPageBgNotifier()),
@@ -35,7 +34,7 @@ class _MainPageState extends State {
bloc: MainPageBloc(),
child: _MainPageContainer(widget.data),
),
- ),
+
);
}
}
@@ -56,6 +55,8 @@ class _MainPageContainerState extends State<_MainPageContainer> {
RefreshController _refreshController =
RefreshController(initialRefresh: false);
+ Widget _floatWidget;
+
void _onLoading() async {
// await Future.delayed(Duration(milliseconds: 1000));
// if (mounted) setState(() {});
@@ -93,35 +94,41 @@ class _MainPageContainerState extends State<_MainPageContainer> {
@override
Widget build(BuildContext context) {
- return MediaQuery.removePadding(
- removeTop: true,
- context: context,
- child: SmartRefresher(
- enablePullDown: true,
- enablePullUp: false,
- header: WaterDropHeader(),
- controller: _refreshController,
- onLoading: _onLoading,
- child: Container(
- width: double.infinity,
- child: StreamBuilder>>(
- stream: _bloc.outData,
- builder: (BuildContext context, AsyncSnapshot snapshot) {
- return Stack(
- fit: StackFit.passthrough,
- children: [
- MineHeaderBgWidget(
- controller: _controller,
- ),
- CustomScrollView(
- controller: _controller,
- slivers: _createContent(context, snapshot.data ?? []),
- )
- ],
- );
- },
- ),
- )),
+ return Scaffold(
+
+ backgroundColor: Color(0xfff9f9f9),
+ floatingActionButton: _floatWidget,
+ floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
+ body: MediaQuery.removePadding(
+ removeTop: true,
+ context: context,
+ child: SmartRefresher(
+ enablePullDown: true,
+ enablePullUp: false,
+ header: WaterDropHeader(),
+ controller: _refreshController,
+ onLoading: _onLoading,
+ child: Container(
+ width: double.infinity,
+ child: StreamBuilder>>(
+ stream: _bloc.outData,
+ builder: (BuildContext context, AsyncSnapshot snapshot) {
+ return Stack(
+ fit: StackFit.passthrough,
+ children: [
+ MineHeaderBgWidget(
+ controller: _controller,
+ ),
+ CustomScrollView(
+ controller: _controller,
+ slivers: _createContent(context, snapshot.data ?? []),
+ )
+ ],
+ );
+ },
+ ),
+ )),
+ ),
);
}
@@ -133,6 +140,10 @@ class _MainPageContainerState extends State<_MainPageContainer> {
WidgetModel.fromJson(Map.from(datas[i]));
print('item.modName ${item.modName}');
+ if (item.modName == 'index_taobao_auth_tip') {
+ _floatWidget = HomeAuth(datas[i]);
+ continue;
+ }
list.addAll(WidgetFactory.create(
item.modName,
isSliver: true,
diff --git a/lib/pages/mine_page/mine_page.dart b/lib/pages/mine_page/mine_page.dart
index d03e364..173da02 100644
--- a/lib/pages/mine_page/mine_page.dart
+++ b/lib/pages/mine_page/mine_page.dart
@@ -73,6 +73,7 @@ class _MinePageState extends State with TickerProviderStateMixin {
body: SafeArea(
child: NestedScrollView(
headerSliverBuilder: _silverBuilder,
+
body: TabBarView(
controller: _tabController,
children: [
diff --git a/lib/pages/orders_page/orders_page.dart b/lib/pages/orders_page/orders_page.dart
index f4ae594..c12e529 100644
--- a/lib/pages/orders_page/orders_page.dart
+++ b/lib/pages/orders_page/orders_page.dart
@@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
+import 'package:zhiying_base_widget/pages/orders_page/views/order_filter.dart';
import 'package:zhiying_base_widget/pages/orders_page/views/order_item_widget.dart';
import 'package:zhiying_base_widget/pages/orders_page/views/order_serch_widget.dart';
import 'package:zhiying_base_widget/pages/orders_page/views/order_tabbar_widget.dart';
@@ -75,6 +76,10 @@ class _OrdersContainerState extends State<_OrdersContainer>
with TickerProviderStateMixin {
TabController _tabController;
+ GlobalKey _tabKey = GlobalKey();
+
+ bool _isFilterShow = false;
+
@override
void initState() {
_tabController = TabController(length: 6, vsync: this);
@@ -86,20 +91,37 @@ class _OrdersContainerState extends State<_OrdersContainer>
return Column(
children: [
OrderSearchWidget(),
- OrderTabbarWidget(_tabController, [
- '全部',
- '已付款',
- '已结算',
- '已失效',
- '全部',
- '已付款',
- ]),
+ OrderTabbarWidget(
+ _tabController,
+ [
+ '全部',
+ '已付款',
+ '已结算',
+ '已失效',
+ '全部',
+ '已付款',
+ ],
+ key: _tabKey,
+ onMoreClick: () {
+ setState(() {
+ _isFilterShow = !_isFilterShow;
+ });
+ },
+ ),
Expanded(
- child: ListView.builder(
- itemCount: 20,
- itemBuilder: (context, index) {
- return OrderItemWidget();
- }),
+ child: Stack(
+ children: [
+ ListView.builder(
+ itemCount: 20,
+ itemBuilder: (context, index) {
+ return OrderItemWidget();
+ }),
+ Visibility(
+ visible: _isFilterShow,
+ child: OrderFilterWidget(),
+ )
+ ],
+ ),
)
],
);
diff --git a/lib/pages/orders_page/views/order_filter.dart b/lib/pages/orders_page/views/order_filter.dart
new file mode 100644
index 0000000..281141e
--- /dev/null
+++ b/lib/pages/orders_page/views/order_filter.dart
@@ -0,0 +1,199 @@
+import 'package:flutter/material.dart';
+import 'package:zhiying_base_widget/widgets/others/action_date_alert/action_date_alert.dart';
+
+class OrderFilterWidget extends StatefulWidget {
+ @override
+ _OrderFilterWidgetState createState() => _OrderFilterWidgetState();
+}
+
+class _OrderFilterWidgetState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ width: double.infinity,
+ height: double.infinity,
+ color: Color(0x55555555),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ _creteTitle('订单来源'),
+ _createTags(),
+ _creteTitle('订单类型'),
+ _createTags(),
+ _creteTitle('订单时间'),
+ _creteTime(),
+ Container(
+ width: double.infinity,
+ height: 0.5,
+ color: Color(0xffe3e3e3),
+ ),
+ _createButtons(),
+ ],
+ ),
+ );
+ }
+
+ Widget _creteTitle(String title) {
+ return Container(
+ padding: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4),
+ width: double.infinity,
+ color: Colors.white,
+ child: Text(
+ title,
+ style: TextStyle(
+ color: Color(0xff333333),
+ fontSize: 14,
+ fontWeight: FontWeight.bold),
+ ),
+ );
+ }
+
+ Widget _createTags() {
+ return Container(
+ width: double.infinity,
+ padding:
+ const EdgeInsets.only(left: 12.5, right: 12.5, bottom: 5, top: 5),
+ color: Colors.white,
+ child: Wrap(
+ crossAxisAlignment: WrapCrossAlignment.start,
+ spacing: 20,
+ runSpacing: 10,
+ children: List.generate(10, (index) {
+ return Container(
+ padding: EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 4),
+ decoration: BoxDecoration(
+ color: Colors.blue, borderRadius: BorderRadius.circular(5)),
+ child: Text(
+ 'aaaa',
+ style: TextStyle(fontSize: 12),
+ ),
+ );
+ }).toList(),
+ ),
+ );
+ }
+
+ Widget _createButtons() {
+ return Container(
+ height: 54,
+ width: double.infinity,
+ decoration: BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.only(
+ bottomLeft: Radius.circular(12.5),
+ bottomRight: Radius.circular(12.5),
+ ),
+ ),
+ child: Row(
+ children: [
+ Expanded(
+ child: Container(
+ color: Colors.transparent,
+ child: Center(
+ child: Text(
+ '重置',
+ style: TextStyle(fontSize: 15, color: Color(0xff999999)),
+ ),
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(top: 12, bottom: 12),
+ height: double.infinity,
+ width: 0.5,
+ color: Color(0xffe3e3e3),
+ ),
+ Expanded(
+ child: Container(
+ color: Colors.transparent,
+ child: Center(
+ child: Text(
+ '确定',
+ style: TextStyle(fontSize: 15, color: Colors.redAccent),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+
+ Widget _creteTime() {
+ return Container(
+ color: Colors.white,
+ padding: EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 20),
+ child: Row(
+ children: [
+ GestureDetector(
+ child: Container(
+ width: 125,
+ height: 25,
+ margin: EdgeInsets.only(right: 10),
+ decoration: BoxDecoration(
+ color: Color(0xfff1f1f1),
+ borderRadius: BorderRadius.circular(5)),
+ child: Center(
+ child: Text(
+ '2020-06',
+ style: TextStyle(
+ fontSize: 12,
+ color: Color(0xff999999),
+ ),
+ ),
+ ),
+ ),
+ onTap: () {
+ _selectDate();
+ },
+ ),
+ Text(
+ '至',
+ style: TextStyle(
+ fontSize: 12,
+ color: Color(0xff999999),
+ ),
+ ),
+ GestureDetector(
+ child: Container(
+ width: 125,
+ height: 25,
+ margin: EdgeInsets.only(left: 10),
+ decoration: BoxDecoration(
+ color: Color(0xfff1f1f1),
+ borderRadius: BorderRadius.circular(5)),
+ child: Center(
+ child: Text(
+ '2020-06',
+ style: TextStyle(
+ fontSize: 12,
+ color: Color(0xff999999),
+ ),
+ ),
+ ),
+ ),
+ onTap: () {
+ _selectDate();
+ },
+ ),
+ ],
+ ),
+ );
+ }
+
+ void _selectDate() async {
+ DateTime dateTime = await showModalBottomSheet(
+ context: context,
+ builder: (context) {
+ return ActionDateAlert(
+ title: '选择起始日期',
+ );
+ },
+ isScrollControlled: false,
+ backgroundColor: Colors.transparent);
+ if (dateTime != null) {
+ String timeStamp =
+ (dateTime.millisecondsSinceEpoch / 1000).ceil().toString();
+ }
+ }
+}
diff --git a/lib/pages/orders_page/views/order_tabbar_widget.dart b/lib/pages/orders_page/views/order_tabbar_widget.dart
index 14d2dd4..158687e 100644
--- a/lib/pages/orders_page/views/order_tabbar_widget.dart
+++ b/lib/pages/orders_page/views/order_tabbar_widget.dart
@@ -3,11 +3,13 @@ import 'package:flutter/material.dart';
class OrderTabbarWidget extends StatelessWidget {
final TabController controller;
final List titles;
+ final VoidCallback onMoreClick;
const OrderTabbarWidget(
this.controller,
this.titles, {
Key key,
+ this.onMoreClick,
}) : super(key: key);
@override
@@ -28,13 +30,20 @@ class OrderTabbarWidget extends StatelessWidget {
.toList(),
),
),
- Container(
- width: 40,
- height: 40,
- child: Icon(
- Icons.filter_4,
- size: 14,
+ GestureDetector(
+ child: Container(
+ width: 40,
+ height: 40,
+ child: Icon(
+ Icons.filter_4,
+ size: 14,
+ ),
),
+ onTap: () {
+ if (onMoreClick != null) {
+ onMoreClick();
+ }
+ },
)
],
));
diff --git a/lib/pages/setting_page/models/setting_page_style_item_model.dart b/lib/pages/setting_page/models/setting_page_style_item_model.dart
new file mode 100644
index 0000000..c166bc3
--- /dev/null
+++ b/lib/pages/setting_page/models/setting_page_style_item_model.dart
@@ -0,0 +1,34 @@
+import 'package:json_annotation/json_annotation.dart';
+
+part 'setting_page_style_item_model.g.dart';
+
+@JsonSerializable()
+class SettingPageStyleItemModel extends Object {
+ @JsonKey(name: 'name')
+ String name;
+
+ @JsonKey(name: 'name_color')
+ String nameColor;
+
+ @JsonKey(name: 'desc')
+ String desc;
+
+ @JsonKey(name: 'desc_color')
+ String descColor;
+
+ @JsonKey(name: 'skip_identifier')
+ String skipIdentifier;
+
+ SettingPageStyleItemModel(
+ this.name,
+ this.nameColor,
+ this.desc,
+ this.descColor,
+ this.skipIdentifier,
+ );
+
+ factory SettingPageStyleItemModel.fromJson(Map srcJson) =>
+ _$SettingPageStyleItemModelFromJson(srcJson);
+
+ Map toJson() => _$SettingPageStyleItemModelToJson(this);
+}
diff --git a/lib/pages/setting_page/models/setting_page_style_item_model.g.dart b/lib/pages/setting_page/models/setting_page_style_item_model.g.dart
new file mode 100644
index 0000000..996447a
--- /dev/null
+++ b/lib/pages/setting_page/models/setting_page_style_item_model.g.dart
@@ -0,0 +1,28 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'setting_page_style_item_model.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+SettingPageStyleItemModel _$SettingPageStyleItemModelFromJson(
+ Map json) {
+ return SettingPageStyleItemModel(
+ json['name'] as String,
+ json['name_color'] as String,
+ json['desc'] as String,
+ json['desc_color'] as String,
+ json['skip_identifier'] as String,
+ );
+}
+
+Map _$SettingPageStyleItemModelToJson(
+ SettingPageStyleItemModel instance) =>
+ {
+ 'name': instance.name,
+ 'name_color': instance.nameColor,
+ 'desc': instance.desc,
+ 'desc_color': instance.descColor,
+ 'skip_identifier': instance.skipIdentifier,
+ };
diff --git a/lib/pages/setting_page/models/setting_page_style_model.dart b/lib/pages/setting_page/models/setting_page_style_model.dart
new file mode 100644
index 0000000..70ed1c4
--- /dev/null
+++ b/lib/pages/setting_page/models/setting_page_style_model.dart
@@ -0,0 +1,51 @@
+import 'package:zhiying_base_widget/pages/setting_page/models/setting_page_style_item_model.dart';
+
+class SettingPageStyleModel extends Object {
+ String appBarName;
+ String appBarNameColor;
+ String appBarBgColor;
+ String logoutName;
+ String logoutNameColor;
+ String settingsBgColor;
+ List> settings;
+
+ SettingPageStyleModel(this.appBarName,
+ this.appBarNameColor,
+ this.appBarBgColor,
+ this.logoutName,
+ this.logoutNameColor,
+ this.settingsBgColor,
+ this.settings,);
+
+ factory SettingPageStyleModel.fromJson(Map json) {
+ var st = (json['settings'] as List).map((list) {
+ return (list as List)
+ ?.map((item) =>
+ SettingPageStyleItemModel.fromJson(
+ Map.from(item)))
+ ?.toList() ??
+ [];
+ })?.toList();
+ return SettingPageStyleModel(
+ json['app_bar_name'] as String,
+ json['app_bar_name_color'] as String,
+ json['app_bar_bg_color'] as String,
+ json['logout_name'] as String,
+ json['logout_name_color'] as String,
+ json['settings_bg_color'] as String,
+ st,
+ );
+ }
+
+ Map toJson() {
+ return {
+ 'app_bar_name': this.appBarName,
+ 'app_bar_name_color': this.appBarNameColor,
+ 'app_bar_bg_color': this.appBarBgColor,
+ 'logout_name': this.logoutName,
+ 'logout_name_color': this.logoutNameColor,
+ 'settings_bg_color': this.settingsBgColor,
+ 'settings': this.settings,
+ };
+ }
+}
diff --git a/lib/pages/setting_page/setting_page.dart b/lib/pages/setting_page/setting_page.dart
index 4425023..d8bb7ec 100644
--- a/lib/pages/setting_page/setting_page.dart
+++ b/lib/pages/setting_page/setting_page.dart
@@ -1,4 +1,10 @@
+import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
+import 'package:zhiying_base_widget/pages/setting_page/models/setting_page_style_item_model.dart';
+import 'package:zhiying_base_widget/pages/setting_page/models/setting_page_style_model.dart';
+import 'package:zhiying_base_widget/pages/setting_page/setting_page_bloc.dart';
+import 'package:zhiying_comm/util/base_bloc.dart';
+import 'package:zhiying_comm/zhiying_comm.dart';
class SettingPage extends StatefulWidget {
final Map data;
@@ -12,6 +18,110 @@ class SettingPage extends StatefulWidget {
class _SettingPageState extends State {
@override
Widget build(BuildContext context) {
- return Scaffold();
+ return BlocProvider(
+ bloc: SettingPageBloc(),
+ child: _SettingContainer(widget.data),
+ );
+ }
+}
+
+class _SettingContainer extends StatefulWidget {
+ final Map data;
+
+ const _SettingContainer(
+ this.data, {
+ Key key,
+ }) : super(key: key);
+
+ @override
+ _SettingContainerState createState() => _SettingContainerState();
+}
+
+class _SettingContainerState extends State<_SettingContainer> {
+ SettingPageBloc _bloc;
+
+ @override
+ void initState() {
+ _bloc = BlocProvider.of(context);
+ _bloc.loadData(widget.data['skip_identifier']);
+ super.initState();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return StreamBuilder(
+ stream: _bloc.outData,
+ builder: (BuildContext context, AsyncSnapshot snapshot) {
+ SettingPageStyleModel style = snapshot.data;
+ return Scaffold(
+ backgroundColor: Color(0xfff9f9f9),
+ appBar: _createNav(style),
+ body: SingleChildScrollView(
+ child: Column(
+ children: style?.settings?.map((list) {
+ return _createSection(list);
+ })?.toList() ??
+ [],
+ ),
+ ));
+ });
+ }
+
+ // 导航栏
+ Widget _createNav(SettingPageStyleModel style) {
+ return CupertinoNavigationBar(
+ border: Border(
+ bottom: BorderSide(
+ width: 0.0, // One physical pixel.
+ style: BorderStyle.none,
+ ),
+ ),
+ backgroundColor: HexColor.fromHex(style?.appBarBgColor ?? 'ffffff'),
+ leading: Navigator.canPop(context)
+ ? GestureDetector(
+ child: Container(
+ padding: EdgeInsets.zero,
+ child: Icon(
+ Icons.arrow_back_ios,
+ size: 20,
+ ),
+ ),
+ onTap: () {
+ if (Navigator.canPop(context)) {
+ Navigator.pop(context);
+ }
+ },
+ )
+ : Container(),
+ middle: Text(
+ style?.appBarName ?? '设置',
+ style: TextStyle(
+ fontSize: 15,
+ color: HexColor.fromHex(style?.appBarNameColor ?? '333333'),
+ ),
+ ),
+ );
+ }
+
+ Widget _createSection(List sections) {
+ return Container(
+ margin: EdgeInsets.only(top: 8),
+ child: Column(
+ children: sections.map((item) {
+ return _createItem(item);
+ }).toList(),
+ ),
+ );
+ }
+
+ Widget _createItem(SettingPageStyleItemModel item) {
+ return Container(
+ width: double.infinity,
+ height: 50,
+ color: Colors.white,
+ child: Row(
+ children: [Text(item.name), Text('aaaaa')],
+ ),
+ );
}
}
diff --git a/lib/pages/setting_page/setting_page_bloc.dart b/lib/pages/setting_page/setting_page_bloc.dart
new file mode 100644
index 0000000..908f78e
--- /dev/null
+++ b/lib/pages/setting_page/setting_page_bloc.dart
@@ -0,0 +1,36 @@
+import 'dart:async';
+import 'dart:convert' as convert;
+
+import 'package:zhiying_base_widget/pages/setting_page/models/setting_page_style_model.dart';
+import 'package:zhiying_comm/util/base_bloc.dart';
+import 'package:zhiying_comm/zhiying_comm.dart';
+
+class SettingPageBloc extends BlocBase {
+ SettingPageStyleModel _style;
+
+ StreamController _styleController =
+ StreamController();
+
+ Stream get outData => _styleController.stream;
+
+ @override
+ void dispose() {
+ _styleController.close();
+ _styleController = null;
+ }
+
+ void loadData(String skipIdentifier) async {
+ Api api = Api(
+ '/api/v1/mod/${skipIdentifier.toString()}', method: NetMethod.GET,);
+ _loadData(await api.onCache());
+ _loadData(await api.onRequest());
+ }
+
+ void _loadData(dynamic data) {
+ Map json = Map.from(data);
+ String d = json['data'];
+ Map da = Map.from(convert.jsonDecode(d));
+ _style = SettingPageStyleModel.fromJson(da);
+ _styleController.add(_style);
+ }
+}
diff --git a/lib/register.dart b/lib/register.dart
index 48e2d79..0992d90 100644
--- a/lib/register.dart
+++ b/lib/register.dart
@@ -8,7 +8,6 @@ import 'package:zhiying_base_widget/pages/setting_page/setting_page.dart';
import 'package:zhiying_base_widget/pages/sreach_page/sreach_page.dart';
import 'package:zhiying_base_widget/pages/sreach_result_page/sreach_result_page.dart';
import 'package:zhiying_base_widget/pages/wallet_page/wallet_page.dart';
-import 'package:zhiying_base_widget/widgets/home/home_auth/home_auth_creater.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/price/goods_details_price_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/slide_banner/goods_details_slide_banner_widget.dart';
@@ -94,12 +93,6 @@ class BaseWidgetRegister {
WidgetFactory.regist('index_banner_two', HomeBannerCreater());
WidgetFactory.regist('index_taobao_auth_tip', HomeAuthCreater());
- /// ==================== 搜索页 ==================== ///
-
-
- /// ==================== 搜索结果页 ==================== ///
-
-
/// ==================== 商品详情 ==================== ///
// 商品详情轮播图
WidgetFactory.regist('product_detail_carousel', DefaultWidgetCreater((model) => GoodsDetailsSlideBannerWidget(model)));
diff --git a/lib/widgets/home/home_auth/home_auth.dart b/lib/widgets/home/home_auth/home_auth.dart
index 9702767..cd5d250 100644
--- a/lib/widgets/home/home_auth/home_auth.dart
+++ b/lib/widgets/home/home_auth/home_auth.dart
@@ -1,10 +1,20 @@
+import 'dart:convert' as convert;
+
+import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
+import 'package:zhiying_base_widget/widgets/home/home_auth/models/home_auth_model.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
class HomeAuth extends StatelessWidget {
final Map data;
+ Map _json;
+ HomeAuthModel _style;
- const HomeAuth(this.data, {Key key}) : super(key: key);
+ HomeAuth(this.data, {Key key}) : super(key: key) {
+ String d = data['data'];
+ _json = convert.jsonDecode(d);
+ _style = HomeAuthModel.fromJson(Map.from(_json));
+ }
@override
Widget build(BuildContext context) {
@@ -13,12 +23,13 @@ class HomeAuth extends StatelessWidget {
width: double.infinity,
margin: EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 4),
decoration: BoxDecoration(
- color: Colors.white,
+ color: HexColor.fromHex(_style?.bgColor ?? 'ffffff'),
borderRadius: BorderRadius.circular(17),
boxShadow: [
BoxShadow(
offset: Offset(2, 1), //x,y轴
- color: Color(0x4d767676), //投影颜色
+ color: HexColor.fromHex(_style?.shadowColor ?? '767676')
+ .withAlpha(70), //投影颜色
blurRadius: 5 //投影距离
)
]),
@@ -28,13 +39,20 @@ class HomeAuth extends StatelessWidget {
margin: EdgeInsets.only(left: 10, right: 8),
width: 20,
height: 20,
- color: Colors.redAccent,
+ child: CachedNetworkImage(
+ imageUrl: _style.icon,
+ fit: BoxFit.contain,
+ ),
),
Expanded(
child: Text(
- '一键授权淘宝权限,让购物更轻松',
+ _style?.text ?? '',
maxLines: 1,
- style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold),
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.bold,
+ color: HexColor.fromHex(_style?.textColor ?? '333333'),
+ ),
),
),
GestureDetector(
@@ -42,11 +60,14 @@ class HomeAuth extends StatelessWidget {
padding: EdgeInsets.only(left: 12, right: 12, top: 3, bottom: 3),
margin: EdgeInsets.only(left: 8, right: 8),
decoration: BoxDecoration(
- color: Colors.redAccent,
+ color: HexColor.fromHex(_style?.tipBtnBgColor ?? 'FF4242'),
borderRadius: BorderRadius.circular(20)),
child: Text(
- '点击授权',
- style: TextStyle(fontSize: 12, color: Colors.white),
+ _style?.tipBtnText ?? '',
+ style: TextStyle(
+ fontSize: 12,
+ color: HexColor.fromHex(_style?.tipBtnTextColor ?? 'ffffff'),
+ ),
),
),
onTap: () async {
diff --git a/lib/widgets/home/home_auth/home_auth_creater.dart b/lib/widgets/home/home_auth/home_auth_creater.dart
deleted file mode 100644
index e2e72b4..0000000
--- a/lib/widgets/home/home_auth/home_auth_creater.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:zhiying_base_widget/widgets/home/home_auth/home_auth_delegate.dart';
-import 'package:zhiying_comm/zhiying_comm.dart';
-
-class HomeAuthCreater extends WidgetCreater {
- @override
- List createWidgets(Map model) {
- return [
- SliverPersistentHeader(
- pinned: true,
- floating: false,
- delegate: HomeAuthDelegate(model),
- ),
- ];
- }
-
- @override
- bool isSliverChild() {
- return true;
- }
-}
diff --git a/lib/widgets/home/home_auth/home_auth_delegate.dart b/lib/widgets/home/home_auth/home_auth_delegate.dart
deleted file mode 100644
index db33761..0000000
--- a/lib/widgets/home/home_auth/home_auth_delegate.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-import 'package:flutter/cupertino.dart';
-import 'package:flutter/material.dart';
-import 'package:zhiying_base_widget/widgets/home/home_auth/home_auth.dart';
-
-class HomeAuthDelegate extends SliverPersistentHeaderDelegate {
- final Map data;
-
- HomeAuthDelegate(this.data);
-
- @override
- Widget build(
- BuildContext context, double shrinkOffset, bool overlapsContent) {
- print('${shrinkOffset.toString()} ${overlapsContent.toString()}');
- return HomeAuth(data);
- }
-
- @override
- double get maxExtent => 40;
-
- @override
- double get minExtent => 40;
-
- @override
- bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) =>
- false; // 如果内容需要更新,设置为true
-}
diff --git a/lib/widgets/home/home_auth/models/home_auth_model.dart b/lib/widgets/home/home_auth/models/home_auth_model.dart
new file mode 100644
index 0000000..3b9a562
--- /dev/null
+++ b/lib/widgets/home/home_auth/models/home_auth_model.dart
@@ -0,0 +1,40 @@
+import 'package:json_annotation/json_annotation.dart';
+
+part 'home_auth_model.g.dart';
+
+@JsonSerializable()
+class HomeAuthModel extends Object {
+
+ @JsonKey(name: 'taobao_auth_icon')
+ String icon;
+
+ @JsonKey(name: 'taoabo_tip_bg_color')
+ String bgColor;
+
+ @JsonKey(name: 'taoabo_tip_shadow_color')
+ String shadowColor;
+
+ @JsonKey(name: 'taoabo_tip_text_color')
+ String textColor;
+
+ @JsonKey(name: 'taoabo_tip_text')
+ String text;
+
+ @JsonKey(name: 'taoabo_tip_btn_text_color')
+ String tipBtnTextColor;
+
+ @JsonKey(name: 'taoabo_tip_btn_bg_color')
+ String tipBtnBgColor;
+
+ @JsonKey(name: 'taoabo_tip_btn_text')
+ String tipBtnText;
+
+ HomeAuthModel(this.icon,this.bgColor,this.shadowColor,this.textColor,this.text,this.tipBtnTextColor,this.tipBtnBgColor,this.tipBtnText,);
+
+ factory HomeAuthModel.fromJson(Map srcJson) => _$HomeAuthModelFromJson(srcJson);
+
+ Map toJson() => _$HomeAuthModelToJson(this);
+
+}
+
+
diff --git a/lib/widgets/home/home_auth/models/home_auth_model.g.dart b/lib/widgets/home/home_auth/models/home_auth_model.g.dart
new file mode 100644
index 0000000..dde266f
--- /dev/null
+++ b/lib/widgets/home/home_auth/models/home_auth_model.g.dart
@@ -0,0 +1,32 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'home_auth_model.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+HomeAuthModel _$HomeAuthModelFromJson(Map json) {
+ return HomeAuthModel(
+ json['taobao_auth_icon'] as String,
+ json['taoabo_tip_bg_color'] as String,
+ json['taoabo_tip_shadow_color'] as String,
+ json['taoabo_tip_text_color'] as String,
+ json['taoabo_tip_text'] as String,
+ json['taoabo_tip_btn_text_color'] as String,
+ json['taoabo_tip_btn_bg_color'] as String,
+ json['taoabo_tip_btn_text'] as String,
+ );
+}
+
+Map _$HomeAuthModelToJson(HomeAuthModel instance) =>
+ {
+ 'taobao_auth_icon': instance.icon,
+ 'taoabo_tip_bg_color': instance.bgColor,
+ 'taoabo_tip_shadow_color': instance.shadowColor,
+ 'taoabo_tip_text_color': instance.textColor,
+ 'taoabo_tip_text': instance.text,
+ 'taoabo_tip_btn_text_color': instance.tipBtnTextColor,
+ 'taoabo_tip_btn_bg_color': instance.tipBtnBgColor,
+ 'taoabo_tip_btn_text': instance.tipBtnText,
+ };
diff --git a/lib/widgets/mine/mine_nav/mine_nav.dart b/lib/widgets/mine/mine_nav/mine_nav.dart
index eff9c3c..10620ff 100644
--- a/lib/widgets/mine/mine_nav/mine_nav.dart
+++ b/lib/widgets/mine/mine_nav/mine_nav.dart
@@ -96,7 +96,7 @@ class MineNavIcon extends StatelessWidget {
),
onTap: () {
print('页面跳转 ${model.skipIdentifier}');
- RouterUtil.route(data, context);
+ RouterUtil.route(model.toJson(), context);
},
);
}
diff --git a/lib/widgets/others/overlay/taobao_auth_overlay.dart b/lib/widgets/others/overlay/taobao_auth_overlay.dart
deleted file mode 100644
index a694302..0000000
--- a/lib/widgets/others/overlay/taobao_auth_overlay.dart
+++ /dev/null
@@ -1,8 +0,0 @@
-import 'package:flutter/material.dart';
-
-class TaobaoAuthOverlay extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Container();
- }
-}