| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- import 'dart:convert';
- import 'package:bbyyy/beans/my_shop_bean_entity.dart';
- import 'package:bbyyy/https/MyDio.dart';
- import 'package:bbyyy/https/url.dart';
- import 'package:bbyyy/my_tools/const.dart';
- import 'package:bbyyy/my_tools/dims.dart';
- import 'package:bbyyy/my_tools/my_colors.dart';
- import 'package:bbyyy/my_tools/my_cookie.dart';
- import 'package:bbyyy/my_tools/my_tools.dart';
- import 'package:bbyyy/my_tools/my_views.dart';
- import 'package:bbyyy/paegs/gang_page/gang_in_page/gang_in_page.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import 'package:pull_to_refresh/pull_to_refresh.dart';
- class QueryGangPage extends StatefulWidget {
- @override
- _QueryGangPageState createState() => _QueryGangPageState();
- }
- class _QueryGangPageState extends State<QueryGangPage> {
- TextEditingController _textEditingController = TextEditingController();
- RefreshController _refreshController = RefreshController();
- List<MyShopBeanDataData> data = [];
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- MyTools().hideKeyboard(context);
- },
- behavior: HitTestBehavior.translucent,
- child: Scaffold(
- body: Column(
- children: [
- MyViews().myAppBar('货帮查询', context, []),
- Container(
- height: 0.5,
- color: MyColors.cF0F0F0,
- ),
- Container(
- color: Colors.white,
- padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
- child: Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(20),
- border: Border.all(color: Colors.grey, width: 1),
- ),
- height: 40,
- width: double.infinity,
- child: Row(
- children: [
- Expanded(
- child: TextField(
- controller: _textEditingController,
- cursorColor: MyColors.cFF4233,
- cursorWidth: 1.0,
- onTap: () {},
- decoration: InputDecoration(
- border: InputBorder.none,
- disabledBorder: InputBorder.none,
- enabledBorder: InputBorder.none,
- focusedBorder: InputBorder.none,
- isDense: true,
- hintText: '请输入货帮名称',
- hintStyle:
- TextStyle(color: MyColors.c999999, fontSize: 16),
- contentPadding:
- const EdgeInsets.fromLTRB(14, 4.5, 8, 4.5),
- ),
- maxLines: 1,
- style: TextStyle(
- color: MyColors.c333333,
- fontSize: 16,
- height: 1.3,
- letterSpacing: 0.2),
- keyboardType: TextInputType.text,
- onChanged: (t) {},
- )),
- GestureDetector(
- onTap: () {
- if (_textEditingController.text.isEmpty) {
- return;
- } else {
- _refreshController.requestRefresh();
- }
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- decoration: BoxDecoration(
- color: MyColors.cFF4233,
- borderRadius: BorderRadius.circular(20)),
- height: 40,
- width: 70,
- child: Text(
- '搜索',
- style: TextStyle(color: Colors.white, fontSize: 14),
- ),
- alignment: Alignment.center,
- ),
- )
- ],
- ),
- ),
- ),
- Expanded(
- flex: 1,
- child: SmartRefresher(
- controller: _refreshController,
- onRefresh: onRefresh,
- child:data.length == 0
- ? SingleChildScrollView(child: noData())
- : ListView.builder(
- itemBuilder: (BuildContext context, int index) {
- return gangItem(context, index);
- },
- itemCount: data.length,
- ),
- ),
- )
- ],
- ),
- ),
- );
- }
- GestureDetector gangItem(BuildContext context, int index) {
- return GestureDetector(
- onTap: () {
- MyTools().toPage(context, GangInPage(data[index], null), (then) {});
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- height: 73,
- child: Column(
- children: [
- Expanded(
- child: Row(
- children: [
- Container(
- margin: EdgeInsets.only(left: 14, right: 14),
- child: ClipRRect(
- child: MyViews().netImg(
- imgURL(data[index].shopPic), 45, 45,
- placeholder: 'images/svg/占位图.svg'),
- borderRadius: BorderRadius.all(Radius.circular(4)),
- ),
- ),
- Expanded(
- child: Container(
- height: 45,
- padding: EdgeInsets.only(right: 14),
- child: Column(
- children: [
- Row(
- children: [
- Expanded(
- child: Text(
- data[index].shopName,
- style: TextStyle(
- color: MyColors.c333333, fontSize: 15),
- )),
- Visibility(
- child: Container(
- decoration: BoxDecoration(
- color: MyColors.cFFCD00,
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(6),
- bottomRight: Radius.circular(6))),
- height: 18,
- width: 30,
- child: Text(
- '自建',
- style: TextStyle(
- color: Colors.white, fontSize: 10),
- ),
- alignment: Alignment.center,
- padding: EdgeInsets.only(bottom: 2),
- ),
- visible:
- data[index].ownerUid == MyCookie().getUID(),
- ),
- ],
- ),
- Row(
- children: [
- Expanded(
- child: Text(
- 'ID:${data[index].shopUid}',
- style: TextStyle(
- color: MyColors.c888888, fontSize: 12),
- ),
- ),
- Visibility(
- child: Container(
- decoration: BoxDecoration(
- color: MyColors.cFF4233,
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(6),
- bottomRight: Radius.circular(6))),
- height: 18,
- width: 30,
- child: Text(
- '欠费',
- style: TextStyle(
- color: Colors.white, fontSize: 10),
- ),
- alignment: Alignment.center,
- padding: EdgeInsets.only(bottom: 2),
- ),
- visible:
- data[index].shopState == shopStateArrearage,
- ),
- ],
- )
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- )
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 73, right: 14),
- height: 0.5,
- color: MyColors.cE7E7E7,
- )
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- );
- }
- void onRefresh() {
- MyDio().query({
- "key": "shop_user",
- "filters": {
- "conditions": [
- "user_uid==${MyCookie().getUID()}",
- "review_state==1",
- "shop_name LIKE ${_textEditingController.text.toString()}"
- ]
- },
- "dims": shopUserDims,
- "paging": [1, 1000],
- "order_by": ["shop_name,DESC"]
- }, (response, hasError) {
- if (!hasError) {
- MyShopBeanEntity entity =
- MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
- data.clear();
- data.addAll(entity.data.data);
- setState(() {
- _refreshController.refreshCompleted();
- });
- }
- }, (error) {});
- }
- }
|