parent
f5b484d3bb
commit
6cad032aa9
@ -1,64 +0,0 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:akuCommunity/utils/fade_route.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'package:akuCommunity/widget/gallery_photo_view_wrapper.dart';
|
||||
|
||||
class ImageHorizontalList extends StatelessWidget {
|
||||
final List<String> imageUrl;
|
||||
ImageHorizontalList({Key key, this.imageUrl}) : super(key: key);
|
||||
|
||||
final Random _random = new Random();
|
||||
int next(int min, int max) => min + _random.nextInt(max - min);
|
||||
List imageModel() {
|
||||
List imgList = List();
|
||||
for (int x = 0; x < imageUrl.length; x++) {
|
||||
GalleryExampleItem item = GalleryExampleItem();
|
||||
item.id = '${next(x + 100, x + 1000)}';
|
||||
item.resource = imageUrl[x];
|
||||
imgList.add(item);
|
||||
}
|
||||
|
||||
return imgList;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 184.w,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(right: 16.w),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(4)),
|
||||
child: GalleryExampleItemThumbnail(
|
||||
galleryExampleItem: imageModel()[index],
|
||||
onTap: () {
|
||||
Navigator.of(context).push(new FadeRoute(
|
||||
page: GalleryPhotoViewWrapper(
|
||||
galleryItems: imageModel(),
|
||||
backgroundDecoration: const BoxDecoration(
|
||||
color: Colors.black,
|
||||
),
|
||||
initialIndex: index,
|
||||
),
|
||||
));
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
itemCount: imageUrl.length,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
import 'package:akuCommunity/model/user/pick_building_model.dart';
|
||||
import 'package:akuCommunity/pages/sign/sign_func.dart';
|
||||
import 'package:akuCommunity/pages/sign/sign_up/sign_up_pick_unit_page.dart';
|
||||
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||
|
||||
class SignUpPickBuildingPage extends StatefulWidget {
|
||||
SignUpPickBuildingPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SignUpPickBuildingPageState createState() => _SignUpPickBuildingPageState();
|
||||
}
|
||||
|
||||
class _SignUpPickBuildingPageState extends State<SignUpPickBuildingPage> {
|
||||
List<PickBuildingModel> _buildingModels = [];
|
||||
_buildItem(PickBuildingModel model) {
|
||||
return ListTile(
|
||||
title: model.label.text.make(),
|
||||
onTap: () {
|
||||
Get.off(SignUpPickUnitPage(buildingId: model.value));
|
||||
},
|
||||
).material(color: Colors.white);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: '选择楼栋',
|
||||
body: EasyRefresh(
|
||||
header: MaterialHeader(),
|
||||
firstRefresh: true,
|
||||
onRefresh: () async {
|
||||
_buildingModels = await SignFunc.getBuildingInfo();
|
||||
setState(() {});
|
||||
},
|
||||
child: ListView.builder(
|
||||
itemBuilder: (context, index) {
|
||||
return _buildItem(_buildingModels[index]);
|
||||
},
|
||||
itemCount: _buildingModels.length,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
import 'package:akuCommunity/pages/sign/sign_up/sign_up_pick_building_page.dart';
|
||||
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||
|
||||
class SignUpPickPlotPage extends StatefulWidget {
|
||||
SignUpPickPlotPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SignUpPickPlotPageState createState() => _SignUpPickPlotPageState();
|
||||
}
|
||||
|
||||
class _SignUpPickPlotPageState extends State<SignUpPickPlotPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: '选择小区',
|
||||
body: ListView(
|
||||
children: [
|
||||
ListTile(
|
||||
title: '五象新区人才公寓'.text.make(),
|
||||
onTap: () => Get.to(SignUpPickBuildingPage()),
|
||||
).material(color: Colors.white),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
import 'package:akuCommunity/base/base_style.dart';
|
||||
import 'package:akuCommunity/pages/sign/sign_up/sign_up_common_widget.dart';
|
||||
import 'package:akuCommunity/pages/sign/sign_up/sign_up_set_nickname_page.dart';
|
||||
import 'package:akuCommunity/provider/sign_up_provider.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
|
||||
class SignUpPickRolePage extends StatefulWidget {
|
||||
SignUpPickRolePage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SignUpPickRolePageState createState() => _SignUpPickRolePageState();
|
||||
}
|
||||
|
||||
class _SignUpPickRolePageState extends State<SignUpPickRolePage> {
|
||||
Widget _buildTile(int type, String title) {
|
||||
final signUpProvider = Provider.of<SignUpProvider>(context);
|
||||
return RadioListTile(
|
||||
groupValue: signUpProvider.type,
|
||||
onChanged: (int value) => signUpProvider.setType(value),
|
||||
value: type,
|
||||
title: title.text.make(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: ListView(
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w),
|
||||
children: [
|
||||
148.hb,
|
||||
signUpTitle('身份选择'),
|
||||
190.hb,
|
||||
...[
|
||||
_buildTile(1, '租客'),
|
||||
_buildTile(2, '业主'),
|
||||
_buildTile(3, '亲属'),
|
||||
].sepWidget(
|
||||
separate: Divider(
|
||||
height: 1.w,
|
||||
thickness: 1.w,
|
||||
color: Color(0xFFD8D8D8),
|
||||
)),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: MaterialButton(
|
||||
height: 89.w,
|
||||
color: kPrimaryColor,
|
||||
shape: StadiumBorder(),
|
||||
disabledColor: kPrimaryColor.withOpacity(0.3),
|
||||
child: '提交'.text.make(),
|
||||
onPressed: () => Get.to(() => SignUpSetNicknamePage()),
|
||||
elevation: 0,
|
||||
).pLTRB(82.w, 0, 82.w, 155.w),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
import 'package:akuCommunity/model/user/pick_building_model.dart';
|
||||
import 'package:akuCommunity/pages/sign/sign_func.dart';
|
||||
import 'package:akuCommunity/pages/sign/sign_up/sign_up_pick_role_page.dart';
|
||||
import 'package:akuCommunity/provider/sign_up_provider.dart';
|
||||
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||
|
||||
class SignUpPickUnitPage extends StatefulWidget {
|
||||
final int buildingId;
|
||||
SignUpPickUnitPage({Key key, this.buildingId}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SignUpPickUnitPageState createState() => _SignUpPickUnitPageState();
|
||||
}
|
||||
|
||||
class _SignUpPickUnitPageState extends State<SignUpPickUnitPage> {
|
||||
List<PickBuildingModel> _buildingModels = [];
|
||||
_buildItem(PickBuildingModel model) {
|
||||
return ListTile(
|
||||
title: model.label.text.make(),
|
||||
onTap: () {
|
||||
final signUpProvider =
|
||||
Provider.of<SignUpProvider>(context, listen: false);
|
||||
signUpProvider.setEstateId(model.value);
|
||||
Get.off(SignUpPickRolePage());
|
||||
},
|
||||
).material(color: Colors.white);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: '选择单元',
|
||||
body: EasyRefresh(
|
||||
header: MaterialHeader(),
|
||||
firstRefresh: true,
|
||||
onRefresh: () async {
|
||||
_buildingModels = await SignFunc.getUnitInfo(widget.buildingId);
|
||||
setState(() {});
|
||||
},
|
||||
child: ListView.builder(
|
||||
itemBuilder: (context, index) {
|
||||
return _buildItem(_buildingModels[index]);
|
||||
},
|
||||
itemCount: _buildingModels.length,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,176 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'package:akuCommunity/model/aku_shop_model.dart';
|
||||
|
||||
class CartProvidde with ChangeNotifier {
|
||||
String cartString;
|
||||
List<AkuShopModel> cartList = [];
|
||||
|
||||
double allPrice = 0;
|
||||
int allGoodsCount = 0;
|
||||
bool isAllCheck = true;
|
||||
|
||||
save(itemid, itemtitle, count, itemprice, itempic) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
cartString = prefs.getString("cartString");
|
||||
var temp = cartString == null ? [] : json.decode(cartString.toString());
|
||||
List<Map> tempList = (temp as List).cast();
|
||||
bool isSave = false;
|
||||
int ival = 0;
|
||||
tempList.forEach((item) {
|
||||
if (item["itemid"] == itemid) {
|
||||
tempList[ival]["count"] = item["count"] + 1;
|
||||
cartList[ival].count++;
|
||||
isSave = true;
|
||||
}
|
||||
ival++;
|
||||
});
|
||||
if (!isSave) {
|
||||
Map<String, dynamic> newGoods = {
|
||||
"itemid": itemid,
|
||||
"itemtitle": itemtitle,
|
||||
"count": count,
|
||||
"itemprice": itemprice,
|
||||
"itempic": itempic,
|
||||
"isCheck": false
|
||||
};
|
||||
tempList.add(newGoods);
|
||||
AkuShopModel _newgoods = AkuShopModel.fromJson(newGoods);
|
||||
int _goodIndex = cartList.indexWhere((element) {
|
||||
return element.itemid == _newgoods.itemid;
|
||||
});
|
||||
_goodIndex > -1
|
||||
? cartList[_goodIndex].count += count
|
||||
: cartList.add(_newgoods);
|
||||
}
|
||||
cartString = json.encode(tempList).toString();
|
||||
print(cartString);
|
||||
print(cartList);
|
||||
prefs.setString("cartInfo", cartString);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
remove() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
prefs.clear();
|
||||
cartList = [];
|
||||
print('清空购物车');
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///获取商品列表
|
||||
getCartInfo() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
cartString = prefs.getString("cartInfo");
|
||||
// cartList = [];
|
||||
if (cartString == null) {
|
||||
cartList = [];
|
||||
} else {
|
||||
List<Map> tempList = (json.decode(cartString.toString()) as List).cast();
|
||||
|
||||
///总价格和总数量初始化
|
||||
allPrice = 0;
|
||||
allGoodsCount = 0;
|
||||
isAllCheck = true;
|
||||
tempList.forEach((item) {
|
||||
if (item["isCheck"]) {
|
||||
allPrice += (item["count"] * (double.parse(item["itemprice"])));
|
||||
allGoodsCount++;
|
||||
} else {
|
||||
isAllCheck = false;
|
||||
}
|
||||
cartList.add(AkuShopModel.fromJson(item));
|
||||
});
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///删除单个购物车商品
|
||||
deleteGoods(String itemid) async {
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// cartString = prefs.getString("cartInfo");
|
||||
// List<Map> tempList = (json.decode(cartString.toString()) as List).cast();
|
||||
// int tempIndex = 0;
|
||||
// int deleteIndex = 0;
|
||||
// tempList.forEach((item) {
|
||||
// if (item["itemid"] == itemid) {
|
||||
// deleteIndex = tempIndex;
|
||||
// }
|
||||
// tempIndex++;
|
||||
// });
|
||||
// tempList.removeAt(deleteIndex);
|
||||
// cartString = json.encode(tempList).toString();
|
||||
// prefs.setString("cartInfo", cartString);
|
||||
// await getCartInfo();
|
||||
|
||||
cartList.removeWhere((element) => element.itemid == itemid);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///单选商品
|
||||
changeCheckState(AkuShopModel cartItem) async {
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// cartString = prefs.getString("cartInfo");
|
||||
// List<Map> tempList = (json.decode(cartString.toString()) as List).cast();
|
||||
// int tempIndex = 0;
|
||||
// int changeIndex = 0;
|
||||
// tempList.forEach((item) {
|
||||
// if (item["itemid"] == cartItem.itemid) {
|
||||
// changeIndex = tempIndex;
|
||||
// }
|
||||
// tempIndex++;
|
||||
// });
|
||||
// tempList[changeIndex] = cartItem.toJson();
|
||||
// cartString = json.encode(tempList).toString();
|
||||
// prefs.setString("cartInfo", cartString);
|
||||
// await getCartInfo();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///全选商品
|
||||
changeALlCheckState(bool isCheck) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
cartString = prefs.getString("cartInfo");
|
||||
List<Map> tempList = (json.decode(cartString.toString()) as List).cast();
|
||||
List<Map> newList = [];
|
||||
tempList.forEach((item) {
|
||||
var newItem = item;
|
||||
newItem["isCheck"] = isCheck;
|
||||
newList.add(newItem);
|
||||
});
|
||||
cartString = json.encode(newList).toString();
|
||||
prefs.setString("cartInfo", cartString);
|
||||
// await getCartInfo();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///商品数量加减
|
||||
addOrReduceAction(AkuShopModel cartItem, String todo) async {
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// cartString = prefs.getString("cartInfo");
|
||||
// List<Map> tempList = (json.decode(cartString.toString()) as List).cast();
|
||||
// int tempIndex = 0;
|
||||
// int changeIndex = 0;
|
||||
// tempList.forEach((item) {
|
||||
// if (item["itemid"] == cartItem.itemid) {
|
||||
// changeIndex = tempIndex;
|
||||
// }
|
||||
// tempIndex++;
|
||||
// });
|
||||
if (todo == 'add') {
|
||||
cartItem.count++;
|
||||
} else if (cartItem.count > 1) {
|
||||
cartItem.count--;
|
||||
}
|
||||
notifyListeners();
|
||||
// tempList[changeIndex] = cartItem.toJson();
|
||||
// cartString = json.encode(tempList).toString();
|
||||
// // prefs.setString("cartInfo", cartString);
|
||||
// await getCartInfo();
|
||||
}
|
||||
}
|
@ -1,89 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SignUpProvider extends ChangeNotifier {
|
||||
int _estateId;
|
||||
int get estateId => _estateId;
|
||||
int _type = 1;
|
||||
int get type => _type;
|
||||
String _nickName;
|
||||
String get nickName => _nickName;
|
||||
String _name;
|
||||
String get name => _name;
|
||||
|
||||
String _tel;
|
||||
String get tel => _tel;
|
||||
|
||||
///default is 1
|
||||
///
|
||||
///证件类型
|
||||
///1. 身份证
|
||||
///2. 营业执照
|
||||
///3. 军人证
|
||||
int _idType = 1;
|
||||
|
||||
///default is 1
|
||||
///
|
||||
///证件类型
|
||||
///1. 身份证
|
||||
///2. 营业执照
|
||||
///3. 军人证
|
||||
int get idType => _idType;
|
||||
String _idNumber;
|
||||
|
||||
String get idNumber => _idNumber;
|
||||
|
||||
Map<String, dynamic> get toMap => {
|
||||
'estateId': _estateId,
|
||||
'type': _type,
|
||||
'nickName': _nickName,
|
||||
'name': _name,
|
||||
'tel': _tel,
|
||||
'idType': _idType,
|
||||
'idNumber': _idNumber,
|
||||
};
|
||||
|
||||
setEstateId(int id) {
|
||||
_estateId = id;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
setType(int type) {
|
||||
_type = type;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
setNickName(String name) {
|
||||
_nickName = name;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
setName(String name) {
|
||||
_name = name;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
setTel(String tel) {
|
||||
_tel = tel;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
setIdType(int idType) {
|
||||
_idType = idType;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
setIdNumber(String idNumber) {
|
||||
_idNumber = idNumber;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
clearAll() {
|
||||
_estateId = null;
|
||||
_type = 1;
|
||||
_nickName = null;
|
||||
_name = null;
|
||||
_tel = null;
|
||||
_idType = null;
|
||||
_idNumber = null;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
class BaseModel {
|
||||
int code;
|
||||
dynamic result;
|
||||
String message;
|
||||
|
||||
BaseModel({this.code, this.result, this.message});
|
||||
|
||||
BaseModel.fromJson(Map<String, dynamic> json) {
|
||||
code = json['Code'] != null ? json['Code'] : json['code'];
|
||||
result = json['Result'] != null ? json['Result'] : json['data'];
|
||||
message = json['Message'] != null ? json['Message'] : json['msg'];
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
class NetHeader {
|
||||
/// 自定义Header
|
||||
static String appID = 'MOBILE-APP-ZNY';
|
||||
static String appSecret = '293FCB579B80BC1D5E6414F0B41C6FF4';
|
||||
static Map<String, dynamic> dmsHeaders = {
|
||||
'AppID': appID,
|
||||
'AppSecret': appSecret,
|
||||
};
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
class NetUrl {
|
||||
/// DMS服务器地址
|
||||
static const String BASE_URL =
|
||||
"https://www.easy-mock.com/mock/5f68981b08d0e90f8b2abb6a/akuCommunity";
|
||||
|
||||
static const String Shop = BASE_URL + "/shop";
|
||||
|
||||
static const String ShopClass = BASE_URL + "/shopClass";
|
||||
|
||||
static const String JJSH = BASE_URL + "/jjsh";
|
||||
|
||||
static const String SMJD = BASE_URL + "/smjd";
|
||||
|
||||
static const String XXFS = BASE_URL + "/xxfs";
|
||||
|
||||
static const String ZBBJ = BASE_URL + "/zbbj";
|
||||
|
||||
static const String CZXS = BASE_URL + "/czxs";
|
||||
|
||||
static const String FSXB = BASE_URL + "/fsxb";
|
||||
|
||||
static const String MYWJ = BASE_URL + "/mywj";
|
||||
|
||||
static const String YLJS = BASE_URL + "/yljs";
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
import "net.dart";
|
||||
import 'net_url.dart';
|
||||
|
||||
class NetUtil {
|
||||
/// 测试商品获取
|
||||
static void akuShop(Map<String, dynamic> params,
|
||||
{Function success, Function failure}) {
|
||||
Net().get(NetUrl.Shop, params, success: success, failure: failure);
|
||||
}
|
||||
|
||||
static void akuShopClass(Map<String, dynamic> params,
|
||||
{Function success, Function failure}) {
|
||||
Net().get(NetUrl.ShopClass, params, success: success, failure: failure);
|
||||
}
|
||||
|
||||
static void akuShopJJSH(Map<String, dynamic> params,
|
||||
{Function success, Function failure}) {
|
||||
Net().get(NetUrl.JJSH, params, success: success, failure: failure);
|
||||
}
|
||||
|
||||
static void akuShopSMJD(Map<String, dynamic> params,
|
||||
{Function success, Function failure}) {
|
||||
Net().get(NetUrl.SMJD, params, success: success, failure: failure);
|
||||
}
|
||||
|
||||
static void akuShopXXFS(Map<String, dynamic> params,
|
||||
{Function success, Function failure}) {
|
||||
Net().get(NetUrl.XXFS, params, success: success, failure: failure);
|
||||
}
|
||||
|
||||
static void akuShopZBBJ(Map<String, dynamic> params,
|
||||
{Function success, Function failure}) {
|
||||
Net().get(NetUrl.ZBBJ, params, success: success, failure: failure);
|
||||
}
|
||||
|
||||
static void akuShopCZXS(Map<String, dynamic> params,
|
||||
{Function success, Function failure}) {
|
||||
Net().get(NetUrl.CZXS, params, success: success, failure: failure);
|
||||
}
|
||||
|
||||
static void akuShopFSXB(Map<String, dynamic> params,
|
||||
{Function success, Function failure}) {
|
||||
Net().get(NetUrl.FSXB, params, success: success, failure: failure);
|
||||
}
|
||||
|
||||
static void akuShopMYWJ(Map<String, dynamic> params,
|
||||
{Function success, Function failure}) {
|
||||
Net().get(NetUrl.MYWJ, params, success: success, failure: failure);
|
||||
}
|
||||
|
||||
static void akuShopYLJS(Map<String, dynamic> params,
|
||||
{Function success, Function failure}) {
|
||||
Net().get(NetUrl.YLJS, params, success: success, failure: failure);
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class FadeRoute extends PageRouteBuilder {
|
||||
final Widget page;
|
||||
FadeRoute({this.page})
|
||||
: super(
|
||||
pageBuilder: (
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
) =>
|
||||
page,
|
||||
transitionsBuilder: (
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
Widget child,
|
||||
) =>
|
||||
FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/// 所有Sp存储的键值对
|
||||
//TODO CLEAN BOTTOM CODES.
|
||||
@Deprecated("sh*t sp_key need to be cleaned.")
|
||||
class SpKey {
|
||||
// 智能token
|
||||
static final String zntoken = "Authorization";
|
||||
// 智能全部登录信息(除token外)
|
||||
static final String loginInfo = "loginInfo";
|
||||
// 智能用户id
|
||||
static final String znMemberId = "memberId";
|
||||
// 智能用户手机
|
||||
static final String znLoginPhone = "loginPhone";
|
||||
// 智能性别
|
||||
static final String znSex = "sex";
|
||||
// 智能生日
|
||||
static final String znBirthday = "birthday";
|
||||
// 智能头像
|
||||
static final String znMemberAvatar = "memberAvatar";
|
||||
// 智能昵称
|
||||
static final String znMemberName = "memberName";
|
||||
// 智能签名
|
||||
static final String znIntroduction = "introduction";
|
||||
// 智能token过期返回的值
|
||||
static final String znTokenFailure = "token";
|
||||
// 智能是否是第一次安装app
|
||||
static final String znIsFirst = "firstLunch";
|
||||
// 智能身高
|
||||
static final String znHeight = "height";
|
||||
// 分销的UID
|
||||
static final String dmsUID = "UID";
|
||||
// 分销的token
|
||||
static final String dmstoken = "AccessToken";
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:synchronized/synchronized.dart';
|
||||
|
||||
class SpUtil {
|
||||
static SpUtil _singleton;
|
||||
static SharedPreferences _prefs;
|
||||
static Lock _lock = Lock();
|
||||
|
||||
static Future<SpUtil> getInstance() async {
|
||||
if (_singleton == null) {
|
||||
await _lock.synchronized(() async {
|
||||
if (_singleton == null) {
|
||||
// keep local instance till it is fully initialized.
|
||||
// 保持本地实例直到完全初始化。
|
||||
var singleton = SpUtil._();
|
||||
await singleton._init();
|
||||
_singleton = singleton;
|
||||
}
|
||||
});
|
||||
}
|
||||
return _singleton;
|
||||
}
|
||||
|
||||
SpUtil._();
|
||||
|
||||
Future _init() async {
|
||||
_prefs = await SharedPreferences.getInstance();
|
||||
}
|
||||
|
||||
/// sp获取动态类型型值
|
||||
static Future<dynamic> getDynamic(String key) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return await prefs.get(key);
|
||||
}
|
||||
|
||||
/// sp存储bool型值
|
||||
static Future<bool> saveBool(String key, bool value) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return await prefs.setBool(key, value);
|
||||
}
|
||||
|
||||
/// sp获取bool型值
|
||||
static Future<bool> getBool(String key) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getBool(key);
|
||||
}
|
||||
|
||||
/// sp存储int型值
|
||||
static Future<bool> saveInt(String key, int value) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return await prefs.setInt(key, value);
|
||||
}
|
||||
|
||||
/// sp获取int型值
|
||||
static Future<int> getInt(String key) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getInt(key);
|
||||
}
|
||||
|
||||
/// sp存储double型值
|
||||
static Future<bool> saveDouble(String key, double value) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return await prefs.setDouble(key, value);
|
||||
}
|
||||
|
||||
/// sp获取double型值
|
||||
static double getDouble(String key, double defValue) {
|
||||
if (_prefs == null) return defValue;
|
||||
return _prefs.getDouble(key) ?? defValue;
|
||||
}
|
||||
|
||||
/// sp存储String型值
|
||||
static Future<bool> saveString(String key, String value) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return await prefs.setString(key, value);
|
||||
}
|
||||
|
||||
/// sp获取String型值
|
||||
static Future<String> getString(String key) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getString(key);
|
||||
}
|
||||
|
||||
/// sp存储List<String>型值
|
||||
static Future<bool> saveStrings(String key, List<String> value) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return await prefs.setStringList(key, value);
|
||||
}
|
||||
|
||||
/// sp获取List<String>型值
|
||||
static Future<List<String>> getStrings(String key) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getStringList(key);
|
||||
}
|
||||
|
||||
/// sp清除所有缓存,返回bool型值,true为清除成功
|
||||
static Future<bool> clear() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return await prefs.clear();
|
||||
}
|
||||
|
||||
/// sp清除单个缓存
|
||||
static Future<bool> remove(String key) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return await prefs.remove(key);
|
||||
}
|
||||
|
||||
/// sp获取所有已经存储的key值,返回结果为Set<String>类型
|
||||
static Future<Set<String>> getKeys() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getKeys();
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:akuCommunity/model/aku_shop_model.dart';
|
||||
import 'package:akuCommunity/provider/cart.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
|
||||
class CartCount extends StatelessWidget {
|
||||
final AkuShopModel cartItem;
|
||||
CartCount({Key key, this.cartItem}) : super(key: key);
|
||||
|
||||
//减按钮
|
||||
Widget _reduceBtn(CartProvidde model) {
|
||||
return InkWell(
|
||||
onTap: cartItem.count > 1
|
||||
? () {
|
||||
model.addOrReduceAction(cartItem, 'reduce');
|
||||
}
|
||||
: null,
|
||||
child: Container(
|
||||
width: 52.w,
|
||||
height: 52.w,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: cartItem.count > 1 ? Color(0xffffffff) : Colors.black12,
|
||||
border:
|
||||
Border(right: BorderSide(width: 0.5, color: Colors.black12))),
|
||||
child: Icon(
|
||||
Icons.remove,
|
||||
color: Color(0xff979797),
|
||||
size: 38.sp,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
//加按钮
|
||||
Widget _addBtn(CartProvidde model) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
model.addOrReduceAction(cartItem, 'add');
|
||||
},
|
||||
child: Container(
|
||||
width: 52.w,
|
||||
height: 52.w,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffffffff),
|
||||
border:
|
||||
Border(left: BorderSide(width: 0.5, color: Colors.black12))),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: Color(0xff979797),
|
||||
size: 38.sp,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
//中间数量显示区域
|
||||
Widget _countArea() {
|
||||
return Container(
|
||||
width: 52.w,
|
||||
height: 52.w,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: Text(
|
||||
'${cartItem.count}',
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: Color(0xff333333),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: 160.w,
|
||||
decoration: BoxDecoration(
|
||||
border:
|
||||
Border.all(width: 0.5, color: Colors.black12) //设置所有的边框宽度为1 颜色为浅灰
|
||||
),
|
||||
child: Consumer<CartProvidde>(builder: (context, model, child) {
|
||||
return Row(
|
||||
children: <Widget>[_reduceBtn(model), _countArea(), _addBtn(model)],
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue