Browse Source

更新页面跳转

更新订单
tags/0.0.1
Weller 4 years ago
parent
commit
61acbff246
15 changed files with 237 additions and 104 deletions
  1. +3
    -3
      .dart_tool/package_config.json
  2. +1
    -1
      lib/pages/goods_share_page/goods_share_image/goods_share_image.dart
  3. +1
    -1
      lib/pages/goods_share_page/goods_share_link/goods_share_link.dart
  4. +3
    -2
      lib/pages/launch_page/launch_page.dart
  5. +21
    -0
      lib/pages/orders_page/models/order_filter_model.dart
  6. +34
    -0
      lib/pages/orders_page/order_content_page.dart
  7. +56
    -30
      lib/pages/orders_page/orders_page.dart
  8. +1
    -1
      lib/pages/security_page/security_mobile/security_mobile_unbind.dart
  9. +1
    -1
      lib/pages/security_page/security_unbind_alipay/security_unbin_alipay.dart
  10. +3
    -2
      lib/widgets/goods_details/footer/goods_details_footer_widget.dart
  11. +61
    -27
      lib/widgets/home/home_quick_entry/home_quick_entry_widget.dart
  12. +3
    -5
      lib/widgets/home/home_slide_banner/home_slide_banner.dart
  13. +1
    -1
      lib/widgets/others/normal_nav/normal_nav.dart
  14. +47
    -29
      lib/widgets/search/input/search_input_widget.dart
  15. +1
    -1
      pubspec.yaml

+ 3
- 3
.dart_tool/package_config.json View File

@@ -537,7 +537,7 @@
},
{
"name": "url_launcher",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.7.4",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.7.5",
"packageUri": "lib/",
"languageVersion": "2.1"
},
@@ -617,10 +617,10 @@
"name": "zhiying_base_widget",
"rootUri": "../",
"packageUri": "lib/",
"languageVersion": "2.1"
"languageVersion": "2.8"
}
],
"generated": "2020-10-15T12:19:28.149342Z",
"generated": "2020-10-16T06:45:33.016683Z",
"generator": "pub",
"generatorVersion": "2.8.2"
}

+ 1
- 1
lib/pages/goods_share_page/goods_share_image/goods_share_image.dart View File

@@ -85,7 +85,7 @@ class _GoodsShareImageState extends State<GoodsShareImage>
return;
Navigator.push(
context,
MaterialPageRoute(
CupertinoPageRoute(
builder: (context) => GoodsShareEditor(_style)));
},
onTempChange: (temp) {


+ 1
- 1
lib/pages/goods_share_page/goods_share_link/goods_share_link.dart View File

@@ -86,7 +86,7 @@ class _GoodsShareLinkState extends State<GoodsShareLink>
return;
Navigator.push(
context,
MaterialPageRoute(
CupertinoPageRoute(
builder: (context) => GoodsShareEditor(_style)));
},
onTempChange: (temp) {


+ 3
- 2
lib/pages/launch_page/launch_page.dart View File

@@ -1,4 +1,5 @@
import 'package:connectivity/connectivity.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/home_page/home_page.dart';
import 'package:zhiying_comm/util/application.dart';
@@ -26,10 +27,10 @@ class _LaunchPageState extends State<LaunchPage> {
Application.init().then((_) {
if (widget.builder != null) {
Navigator.of(context)
.pushReplacement(MaterialPageRoute(builder: widget.builder));
.pushReplacement(CupertinoPageRoute(builder: widget.builder));
} else {
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (context) => HomePage()));
CupertinoPageRoute(builder: (context) => HomePage()));
}
}).catchError((err) {
Logger.error(err);


+ 21
- 0
lib/pages/orders_page/models/order_filter_model.dart View File

@@ -0,0 +1,21 @@
// 订单筛选条件
class OrderFilterModel {
final String state; // 否 string 订单状态0已付款,1已收货,2成功,3失效
final String keyword; // 否 string 关键字
final String start_time; // 否 string 开始时间
final String end_time; // 否 string 结束时间
final String type; // 否 string 订单类型self自购, share分享, fans粉丝
final String provider; // 否 string 供应商taobao, jd, pdd, vip, kaola,suning,own自营
final String page_no; // 否 string 页码
final String page_size;

OrderFilterModel(
{this.state,
this.keyword,
this.start_time,
this.end_time,
this.type,
this.provider,
this.page_no,
this.page_size}); // 否 string 页数
}

+ 34
- 0
lib/pages/orders_page/order_content_page.dart View File

@@ -0,0 +1,34 @@
import 'package:event_bus/event_bus.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/orders_page/views/order_item_widget.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class OrderContentPage extends StatefulWidget {
final EventBus filter;

const OrderContentPage({Key key, this.filter}) : super(key: key);

@override
_OrderContentPageState createState() => _OrderContentPageState();
}

class _OrderContentPageState extends State<OrderContentPage> {
@override
void initState() {
// 每次滑动刷新数据
widget.filter?.streamController?.add((filter) {
Logger.debug(filter.toString());
});
super.initState();
}

@override
Widget build(BuildContext context) {
print(context.toString());
return ListView.builder(
itemCount: 20,
itemBuilder: (context, index) {
return OrderItemWidget();
});
}
}

+ 56
- 30
lib/pages/orders_page/orders_page.dart View File

@@ -1,8 +1,10 @@
import 'package:event_bus/event_bus.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/orders_page/models/order_filter_model.dart';
import 'package:zhiying_base_widget/pages/orders_page/order_content_page.dart';
import 'package:zhiying_base_widget/pages/orders_page/order_search_page.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';

@@ -10,7 +12,8 @@ import 'package:zhiying_base_widget/pages/orders_page/views/order_tabbar_widget.
class OrdersPage extends StatefulWidget {
final Map<String, dynamic> data;

const OrdersPage(this.data, {
const OrdersPage(
this.data, {
Key key,
}) : super(key: key);

@@ -42,19 +45,19 @@ class _OrdersPageState extends State<OrdersPage> {
backgroundColor: Colors.white,
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);
}
},
)
child: Container(
padding: EdgeInsets.zero,
child: Icon(
Icons.arrow_back_ios,
size: 20,
),
),
onTap: () {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
},
)
: Container(),
middle: Text(
'我的订单',
@@ -75,14 +78,45 @@ class _OrdersContainer extends StatefulWidget {
class _OrdersContainerState extends State<_OrdersContainer>
with TickerProviderStateMixin {
TabController _tabController;

GlobalKey _tabKey = GlobalKey();

final EventBus _eventBus = EventBus();
final OrderFilterModel _filter = OrderFilterModel();

bool _isFilterShow = false;
List<String> _titles = [
'全部',
'已付款',
'已结算',
'已失效',
'全部',
'已付款',
];
List<Widget> _contents = [];

@override
void initState() {
_tabController = TabController(length: 6, vsync: this);
_contents = [
OrderContentPage(
filter: _eventBus,
),
OrderContentPage(
filter: _eventBus,
),
OrderContentPage(
filter: _eventBus,
),
OrderContentPage(
filter: _eventBus,
),
OrderContentPage(
filter: _eventBus,
),
OrderContentPage(
filter: _eventBus,
),
];
super.initState();
}

@@ -94,21 +128,14 @@ class _OrdersContainerState extends State<_OrdersContainer>
child: OrderSearchWidget(),
onTap: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (BuildContext context) {
.push(CupertinoPageRoute(builder: (BuildContext context) {
return OrderSearchPage();
}));
},
),
OrderTabbarWidget(
_tabController,
[
'全部',
'已付款',
'已结算',
'已失效',
'全部',
'已付款',
],
_titles,
key: _tabKey,
onMoreClick: () {
setState(() {
@@ -119,11 +146,10 @@ class _OrdersContainerState extends State<_OrdersContainer>
Expanded(
child: Stack(
children: <Widget>[
ListView.builder(
itemCount: 20,
itemBuilder: (context, index) {
return OrderItemWidget();
}),
TabBarView(
children: _contents,
controller: _tabController,
),
Visibility(
visible: _isFilterShow,
child: OrderFilterWidget(),


+ 1
- 1
lib/pages/security_page/security_mobile/security_mobile_unbind.dart View File

@@ -160,7 +160,7 @@ class _SecurityMobileUnbindState extends State<SecurityMobileUnbind> {
method: NetMethod.POST, onSuccess: (result) {
_status['mobile_setting'] = '0';
_status['code'] = _codeController.text;
Navigator.of(context).pushReplacement(MaterialPageRoute(
Navigator.of(context).pushReplacement(CupertinoPageRoute(
builder: (context) => SecurityMobile(widget.model)));
});
}


+ 1
- 1
lib/pages/security_page/security_unbind_alipay/security_unbin_alipay.dart View File

@@ -150,7 +150,7 @@ class _SecurityUnbinAlipayState extends State<SecurityUnbinAlipay> {
Logger.debug(result);
Fluttertoast.showToast(msg: '解绑成功');
_status['alipay_setting'] = '0';
Navigator.of(context).pushReplacement(MaterialPageRoute(
Navigator.of(context).pushReplacement(CupertinoPageRoute(
builder: (context) => SecurityBindAlipayPage(widget.model)));
});
}


+ 3
- 2
lib/widgets/goods_details/footer/goods_details_footer_widget.dart View File

@@ -1,6 +1,7 @@
import 'dart:convert';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_alibc/alibc_model.dart';
import 'package:flutter_alibc/flutter_alibc.dart';
@@ -55,7 +56,7 @@ class _GooddsDetailsFooterContainerState
void _openHome() {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
CupertinoPageRoute(
builder: (BuildContext context) =>
PageFactory.create('homePage', null)),
(Route<dynamic> route) => false,
@@ -93,7 +94,7 @@ class _GooddsDetailsFooterContainerState
return;
}
}
Navigator.of(context).push(MaterialPageRoute(
Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => GoodsSharePage(widget.model)));
}
}


+ 61
- 27
lib/widgets/home/home_quick_entry/home_quick_entry_widget.dart View File

@@ -1,12 +1,13 @@
import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:zhiying_base_widget/widgets/home/home_quick_entry/bloc/bloc.dart';
import 'package:zhiying_base_widget/widgets/home/home_quick_entry/bloc/home_quick_entry_repository.dart';
import 'package:zhiying_base_widget/widgets/home/home_quick_entry/home_quick_entry_sk.dart';
import 'package:zhiying_base_widget/widgets/home/home_quick_entry/model/home_quick_entry_model.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

///
/// 首页的快速入口widget
@@ -19,7 +20,8 @@ class HomeQuickEntryWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocProvider<HomeQuickEntryBloc>(
create: (_) => HomeQuickEntryBloc(repository: HomeQuickEntryRepository())..add(HomeQuickEntryInitEvent(model: model)),
create: (_) => HomeQuickEntryBloc(repository: HomeQuickEntryRepository())
..add(HomeQuickEntryInitEvent(model: model)),
child: HomeQuickEntryWidgetContianer(),
);
}
@@ -27,10 +29,12 @@ class HomeQuickEntryWidget extends StatelessWidget {

class HomeQuickEntryWidgetContianer extends StatefulWidget {
@override
_HomeQuickEntryWidgetContianerState createState() => _HomeQuickEntryWidgetContianerState();
_HomeQuickEntryWidgetContianerState createState() =>
_HomeQuickEntryWidgetContianerState();
}

class _HomeQuickEntryWidgetContianerState extends State<HomeQuickEntryWidgetContianer> {
class _HomeQuickEntryWidgetContianerState
extends State<HomeQuickEntryWidgetContianer> {
@override
Widget build(BuildContext context) {
return BlocConsumer<HomeQuickEntryBloc, HomeQuickEntryState>(
@@ -55,15 +59,20 @@ class _HomeQuickEntryWidgetContianerState extends State<HomeQuickEntryWidgetCont
);
}


Widget _getMainWidget(HomeQuickEntryModel model) {
int dataSize = 15;//model?.type_normal?.length ?? 0; // 总数
int columSize = 5;//int.parse(model?.colum_size ?? '5'); // 列数
int rowSize = 2;//int.parse(model?.row_size ?? '2'); // 行数
rowSize = columSize * rowSize <= dataSize ? rowSize : dataSize % columSize == 0 ? dataSize ~/ columSize : (dataSize ~/ columSize) +1;
int dataSize = 15; //model?.type_normal?.length ?? 0; // 总数
int columSize = 5; //int.parse(model?.colum_size ?? '5'); // 列数
int rowSize = 2; //int.parse(model?.row_size ?? '2'); // 行数
rowSize = columSize * rowSize <= dataSize
? rowSize
: dataSize % columSize == 0
? dataSize ~/ columSize
: (dataSize ~/ columSize) + 1;

// 页数 总数 % (columSize * rowSize)
int pageCount = dataSize % (rowSize * columSize) == 0 ? dataSize ~/ (rowSize * columSize) : (dataSize ~/ (rowSize * columSize)) + 1;
int pageCount = dataSize % (rowSize * columSize) == 0
? dataSize ~/ (rowSize * columSize)
: (dataSize ~/ (rowSize * columSize)) + 1;

// 进度条底部距离
const double bottomSize = 15.0;
@@ -75,8 +84,9 @@ class _HomeQuickEntryWidgetContianerState extends State<HomeQuickEntryWidgetCont
const double titleHeight = 20;

// 总体的高度 == 行数 * (图片高度 + 标题高度 + 元素之间的边距) + 上下内边距
double containerHeight = rowSize * (iconHeight + titleHeight + itemPadding*2) + (bottomSize*2);

double containerHeight =
rowSize * (iconHeight + titleHeight + itemPadding * 2) +
(bottomSize * 2);

return Container(
// padding: const EdgeInsets.only(bottom: bottomSize, top: bottomSize),
@@ -127,7 +137,8 @@ class _HomeQuickEntryWidgetContianerState extends State<HomeQuickEntryWidgetCont
list.add(i);
}

return SwiperCustomPagination(builder: (BuildContext context, SwiperPluginConfig config) {
return SwiperCustomPagination(
builder: (BuildContext context, SwiperPluginConfig config) {
return Align(
alignment: Alignment(0.0, 1),
child: Row(
@@ -136,10 +147,13 @@ class _HomeQuickEntryWidgetContianerState extends State<HomeQuickEntryWidgetCont
children: list.map((index) {
var borderRadius;
if (index == 0) {
borderRadius = BorderRadius.only(topLeft: Radius.circular(2), bottomLeft: Radius.circular(2));
borderRadius = BorderRadius.only(
topLeft: Radius.circular(2), bottomLeft: Radius.circular(2));
}
if (index == list.length - 1) {
borderRadius = BorderRadius.only(topRight: Radius.circular(2), bottomRight: Radius.circular(2));
borderRadius = BorderRadius.only(
topRight: Radius.circular(2),
bottomRight: Radius.circular(2));
}

if (index == config.activeIndex) {
@@ -149,7 +163,11 @@ class _HomeQuickEntryWidgetContianerState extends State<HomeQuickEntryWidgetCont
return Container(
height: 4,
width: 25,
decoration: BoxDecoration(borderRadius: borderRadius, color: index == config.activeIndex ? HexColor.fromHex('#FF4242') : HexColor.fromHex('#FFFFFF')),
decoration: BoxDecoration(
borderRadius: borderRadius,
color: index == config.activeIndex
? HexColor.fromHex('#FF4242')
: HexColor.fromHex('#FFFFFF')),
);
}).toList(),
),
@@ -170,13 +188,22 @@ class HomeQuickEntrySwiperItem extends StatelessWidget {
final int dataSize;
final double itemPadding;

const HomeQuickEntrySwiperItem({this.page, this.data, this.showDataSize, this.columSize, this.rowSize, this.itemPadding, this.dataSize});
const HomeQuickEntrySwiperItem(
{this.page,
this.data,
this.showDataSize,
this.columSize,
this.rowSize,
this.itemPadding,
this.dataSize});

@override
Widget build(BuildContext context) {
// 当前显示的个数
// int itemCount = (data.length - page * showDataSize) >= showDataSize ? showDataSize : (data.length - page * showDataSize);
int itemCount = (dataSize - page * showDataSize) >= showDataSize ? showDataSize : (dataSize - page * showDataSize);
int itemCount = (dataSize - page * showDataSize) >= showDataSize
? showDataSize
: (dataSize - page * showDataSize);
print('${itemCount}');
return Container(
// color: Colors.cyan,
@@ -203,8 +230,12 @@ class HomeQuickEntrySwiperItem extends StatelessWidget {
itemBuilder: (context, i) {
// return HomeQuickEntryItem(data: data[itemCount == showDataSize ? page * showDataSize + i : page == 0 ? page + i : page * showDataSize + i], itemPaddding: itemPadding,);
// 最后一行
bool isLast = i >= (rowSize -1) * columSize;
return HomeQuickEntryItem(data: null, itemPaddding: itemPadding, isLastRow: isLast,);
bool isLast = i >= (rowSize - 1) * columSize;
return HomeQuickEntryItem(
data: null,
itemPaddding: itemPadding,
isLastRow: isLast,
);
}),
);
}
@@ -222,7 +253,7 @@ class HomeQuickEntryItem extends StatelessWidget {

/// 子图标的点击
_itemOnClick(context) {
Navigator.push(context, MaterialPageRoute(builder: (context) {
Navigator.push(context, CupertinoPageRoute(builder: (context) {
return PageFactory.create('login', null);
}));
}
@@ -232,27 +263,30 @@ class HomeQuickEntryItem extends StatelessWidget {
return GestureDetector(
onTap: () => _itemOnClick(context),
child: Container(
margin: EdgeInsets.only(bottom: isLastRow ? 0 :0),
margin: EdgeInsets.only(bottom: isLastRow ? 0 : 0),
color: Colors.red,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
// 图片
MyNetWorkImage(data?.img?? 'https://profile.csdnimg.cn/3/3/0/3_canhuashu'),
MyNetWorkImage(
data?.img ?? 'https://profile.csdnimg.cn/3/3/0/3_canhuashu'),

Padding(
padding: const EdgeInsets.only(top: 5),
child: Text(
data?.title_1 ?? '京东',
style: TextStyle(color: HexColor.fromHex('#666666'), fontSize: 20.sp),
style: TextStyle(
color: HexColor.fromHex('#666666'), fontSize: 20.sp),
)),

Padding(
padding: const EdgeInsets.only(top: 5),
child: Text(
data?.title_1 ?? '京东',
style: TextStyle(color: HexColor.fromHex('#666666'), fontSize: 20.sp),
style: TextStyle(
color: HexColor.fromHex('#666666'), fontSize: 20.sp),
)),
// SizedBox(height: 25.h,)
],
@@ -266,8 +300,8 @@ class HomeQuickEntryItem extends StatelessWidget {
/// 图片build 优化
///
class MyNetWorkImage extends StatelessWidget {

final String imgUrl;

const MyNetWorkImage(this.imgUrl);

@override


+ 3
- 5
lib/widgets/home/home_slide_banner/home_slide_banner.dart View File

@@ -6,7 +6,6 @@ import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:provider/provider.dart';
import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifier.dart';
import 'package:zhiying_base_widget/pages/team_details_page/team_details_page.dart';
import 'package:zhiying_base_widget/pages/team_page/team_page.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

import 'bloc/bloc.dart';
@@ -49,13 +48,12 @@ class _HomeSlideBannerContainerState extends State<HomeSlideBannerContainer> {
void _itemOnClick(IndexCarousel model) {
print('点击了 $model');
// RouterUtil.route(model, model.toJson(), context);
// Navigator.push(context, MaterialPageRoute(
// Navigator.push(context, CupertinoPageRoute(
// builder: (_) => PageFactory.create('goods_details', null)
// ));
// Navigator.push(context, CupertinoPageRoute(builder: (_)=> TeamPage()));
Navigator.push(context, MaterialPageRoute(
builder: (_)=> TeamDetailsPage()
));
Navigator.push(
context, CupertinoPageRoute(builder: (_) => TeamDetailsPage()));
}

@override


+ 1
- 1
lib/widgets/others/normal_nav/normal_nav.dart View File

@@ -90,7 +90,7 @@ class NormalNav extends StatelessWidget {
),
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) {
CupertinoPageRoute(builder: (context) {
return MinePage();
}));
},


+ 47
- 29
lib/widgets/search/input/search_input_widget.dart View File

@@ -1,19 +1,19 @@
import 'dart:convert';
import 'dart:ui';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:provider/provider.dart';
import 'package:zhiying_base_widget/pages/search_page/notifier/search_tag_notifier.dart';
import 'package:zhiying_base_widget/pages/search_result_page/search_result_page.dart';
import 'package:zhiying_base_widget/pages/search_think_page/bloc/search_think_bloc.dart';
import 'package:zhiying_base_widget/pages/search_think_page/search_think_page.dart';
import 'package:zhiying_base_widget/widgets/home/home_quick_entry/cached_network_image_util.dart';
import 'package:zhiying_base_widget/widgets/search/input/model/search_input_model.dart';
import 'package:zhiying_base_widget/widgets/search/input/search_input_sk.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:provider/provider.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fluttertoast/fluttertoast.dart';

///
/// 搜索页的搜索框
@@ -38,31 +38,38 @@ class _SearchInputWidgetState extends State<SearchInputWidget> {
/// 点击搜索按钮
void _onSearchButtomClick() async {
String content = _editingController?.text?.toString()?.trim() ?? '';

/// TODO 保存历史标签
if (!EmptyUtil.isEmpty(content)) {
await Provider.of<SearchTagNotifier>(context, listen: false).addTag(content);
Navigator.push(context, CupertinoPageRoute(builder: (_) => SearchResultPage({'keywords': content, 'tag': 'search_page'})));
}else{
await Provider.of<SearchTagNotifier>(context, listen: false)
.addTag(content);
Navigator.push(
context,
CupertinoPageRoute(
builder: (_) => SearchResultPage(
{'keywords': content, 'tag': 'search_page'})));
} else {
Fluttertoast.showToast(msg: '输入内容不能为空!');
}
}

/// 【弃用】打开搜索联想页面
void _openSearchThinkPage(){
Navigator.push(context, MaterialPageRoute(
builder: (_)=> SearchThinkPage({})
));
void _openSearchThinkPage() {
Navigator.push(
context, CupertinoPageRoute(builder: (_) => SearchThinkPage({})));
}

/// 搜索框值改变
void _searchInputChange(String text){
if(!EmptyUtil.isEmpty(text)){
void _searchInputChange(String text) {
if (!EmptyUtil.isEmpty(text)) {
// 进行网络更新
print('输入框的内容是 $text');
BlocProvider.of<SearchThinkBloc>(context).add(SearchThinkKeyWrodsChangeEvent(text));
}else{
BlocProvider.of<SearchThinkBloc>(context)
.add(SearchThinkKeyWrodsChangeEvent(text));
} else {
/// 输入框为空的时候,隐藏联想视图,显示原本的视图
BlocProvider.of<SearchThinkBloc>(context).add(SearchThinkShowBaseViewEvent());
BlocProvider.of<SearchThinkBloc>(context)
.add(SearchThinkShowBaseViewEvent());
}
}

@@ -103,12 +110,16 @@ class _SearchInputWidgetState extends State<SearchInputWidget> {
return Container(
color: Colors.white,
width: double.infinity,
margin: EdgeInsets.only(top: MediaQueryData.fromWindow(window).padding.top + 7.5, left: 12.5, right: 12.5),
margin: EdgeInsets.only(
top: MediaQueryData.fromWindow(window).padding.top + 7.5,
left: 12.5,
right: 12.5),
child: Row(
children: <Widget>[
/// 返回键
_getReturnWidget(),
const SizedBox(width: 8.5),

/// 输入框
Expanded(
child: Container(
@@ -143,9 +154,9 @@ class _SearchInputWidgetState extends State<SearchInputWidget> {
}

/// 返回键
Widget _getReturnWidget(){
Widget _getReturnWidget() {
return GestureDetector(
onTap: ()=> Navigator.maybePop(context),
onTap: () => Navigator.maybePop(context),
child: Container(
child: Icon(
Icons.arrow_back_ios,
@@ -157,7 +168,6 @@ class _SearchInputWidgetState extends State<SearchInputWidget> {
);
}


/// 搜索icon
Widget _getSearchIconWidget(SearchInputModel model) {
return Container(
@@ -176,19 +186,24 @@ class _SearchInputWidgetState extends State<SearchInputWidget> {
return Container(
height: double.infinity,
alignment: Alignment.centerLeft,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: HexColor.fromHex('#F9F9F9')),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: HexColor.fromHex('#F9F9F9')),
// padding: const EdgeInsets.symmetric(vertical: 6),
child: TextField(
showCursor: true,
// readOnly: true,
// onTap: ()=> _openSearchThinkPage(),
onChanged: (val)=> _searchInputChange(val),
onChanged: (val) => _searchInputChange(val),
cursorWidth: 1,
onSubmitted: (text) => _onSearchButtomClick(),
controller: _editingController,
focusNode: _focusNode,
cursorColor: Colors.transparent,
style: TextStyle(fontSize: 14, color: HexColor.fromHex('#333333'), textBaseline: TextBaseline.alphabetic),
style: TextStyle(
fontSize: 14,
color: HexColor.fromHex('#333333'),
textBaseline: TextBaseline.alphabetic),
decoration: InputDecoration(
filled: true,
isDense: true,
@@ -203,7 +218,10 @@ class _SearchInputWidgetState extends State<SearchInputWidget> {
disabledBorder: InputBorder.none,
enabledBorder: InputBorder.none,
hintText: model?.search_inpu_hint_text ?? '搜索更多优惠商品',
hintStyle: TextStyle(color: HexColor.fromHex('#999999'), fontSize: 14, textBaseline: TextBaseline.alphabetic),
hintStyle: TextStyle(
color: HexColor.fromHex('#999999'),
fontSize: 14,
textBaseline: TextBaseline.alphabetic),
),
),
);
@@ -217,10 +235,10 @@ class _SearchInputWidgetState extends State<SearchInputWidget> {
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 17.5, vertical: 6),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [HexColor.fromHex(model?.search_button_color ?? '#FD5E5E'), HexColor.fromHex(model?.search_button_t ?? '#FF0100')],
begin: Alignment.centerLeft,
end: Alignment.centerRight),
gradient: LinearGradient(colors: [
HexColor.fromHex(model?.search_button_color ?? '#FD5E5E'),
HexColor.fromHex(model?.search_button_t ?? '#FF0100')
], begin: Alignment.centerLeft, end: Alignment.centerRight),
borderRadius: BorderRadius.circular(30),
),
child: Text(


+ 1
- 1
pubspec.yaml View File

@@ -5,7 +5,7 @@ author:
homepage:

environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.8.0 <3.0.0"

dependencies:
flutter:


Loading…
Cancel
Save