remove unused codes & update login logic

hmxc
小赖 4 years ago
parent f5b484d3bb
commit 6cad032aa9

@ -13,7 +13,6 @@ import 'package:provider/provider.dart';
import 'package:akuCommunity/constants/app_theme.dart';
import 'package:akuCommunity/pages/splash/splash_page.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:akuCommunity/provider/cart.dart';
import 'package:akuCommunity/provider/sign_up_provider.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/utils/developer_util.dart';
@ -72,7 +71,6 @@ class _MyAppState extends State<MyApp> {
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (context) => CartProvidde()),
ChangeNotifierProvider(create: (context) => UserProvider()),
ChangeNotifierProvider(create: (context) => AppProvider()),
ChangeNotifierProvider(create: (context) => SignUpProvider()),

@ -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,
),
);
}
}

@ -48,6 +48,7 @@ class _AnimateAppBarState extends State<AnimateAppBar> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (appProvider?.location != null)
Text(
appProvider?.location['city'] ?? '',
style: TextStyle(

@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:ui';
import 'package:akuCommunity/pages/sign/sign_up/sign_up_set_nickname_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -21,7 +22,6 @@ import 'package:akuCommunity/extensions/num_ext.dart';
import 'package:akuCommunity/pages/setting_page/agreement_page/agreement_page.dart';
import 'package:akuCommunity/pages/setting_page/agreement_page/privacy_page.dart';
import 'package:akuCommunity/pages/sign/sign_func.dart';
import 'package:akuCommunity/pages/sign/sign_up/sign_up_pick_plot_page.dart';
import 'package:akuCommunity/pages/tab_navigator.dart';
import 'package:akuCommunity/provider/sign_up_provider.dart';
import 'package:akuCommunity/provider/user_provider.dart';
@ -98,7 +98,7 @@ class _SignInPageState extends State<SignInPage> {
} else {
cancel();
signUpProvider.setTel(_phone.text);
await Get.to(() => SignUpPickPlotPage());
await Get.to(() => SignUpSetNicknamePage());
signUpProvider.clearAll();
}
} else {

@ -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,3 +1,6 @@
import 'package:akuCommunity/pages/sign/sign_func.dart';
import 'package:akuCommunity/pages/tab_navigator.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flustars/flustars.dart';
@ -8,7 +11,6 @@ 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_verify_page.dart';
import 'package:akuCommunity/provider/sign_up_provider.dart';
import 'package:akuCommunity/utils/headers.dart';
@ -68,12 +70,15 @@ class _SignUpSetNicknamePageState extends State<SignUpSetNicknamePage> {
height: 89.w,
child: '保存'.text.make(),
shape: StadiumBorder(),
onPressed: () {
onPressed: () async {
final cancel = BotToast.showLoading();
if (_globalKey.currentState.validate()) {
final signUpProvider =
Provider.of<SignUpProvider>(context, listen: false);
signUpProvider.setNickName(_textEditingController.text);
Get.to(() => SignUpVerifyPage());
cancel();
bool result = await SignFunc.signUp();
if (result) Get.offAll(() => TabNavigator());
}
},
),

@ -83,8 +83,6 @@ class _SignUpVerifyPageState extends State<SignUpVerifyPage> {
Provider.of<SignUpProvider>(context, listen: false);
if (_formKey.currentState.validate()) {
signUpProvider.setName(_nameController.text);
signUpProvider.setIdNumber(_idNumberController.text);
bool result = await SignFunc.signUp();
if (result) Get.offAll(() => TabNavigator());
}

@ -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,214 +0,0 @@
import 'dart:convert';
import 'dart:io';
import 'package:dio/adapter.dart';
import 'package:dio/dio.dart';
import 'base_model.dart';
// import 'net_header.dart';
// import 'package:light_wave/utils/global_toast.dart';
// import 'package:light_wave/pages/login/login_page.dart';
// import 'package:light_wave/routers/application.dart';
// import 'package:fluttertoast/fluttertoast.dart';
///
enum Method { get, post }
@Deprecated("net need to be cleaned.")
class Net {
//
factory Net() => _getInstance();
static Net get instance => _getInstance();
static Net _instance;
Dio dio;
Net._internal() {
//
dio = Dio(
BaseOptions(
connectTimeout: 60000, // .
receiveTimeout: 10000, // , .
// contentType: ContentType.parse('x-www-form-urlencoded').toString(),
// responseType: ResponseType.plain,
// responseType: ResponseType.json,
),
);
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) {
//TODO
return true;
};
};
}
/// (便)
static final interceptors = InterceptorsWrapper(
///
onRequest: (options, handler) {
print("--------------------请求参数---------------------");
print(json.encode(options.headers));
print(options.method);
print(options.queryParameters);
print(options.baseUrl + options.path);
print(options.data);
print("--------------------请求参数---------------------");
return handler.next(options);
},
///
onResponse: (response, handler) {
// Log.i("--------------------响应结果---------------------");
// Log.e("response.statusCode", "${response.statusCode}");
// Log.e("response.data", "${json.encode(response.data)}");
// Log.e("response.headers", "${response.headers}");
// Log.i("--------------------响应结果---------------------");
return handler.next(response);
},
///
onError: (DioError e, handler) {
// Log.e("DioError", "$e");
return handler.next(e);
},
);
//
static Net _getInstance() {
if (_instance == null) {
_instance = Net._internal();
}
return _instance;
}
get(String url, Map<String, dynamic> params,
{Function success, Function failure}) {
_doRequest(url, params, Method.get, success, failure);
}
post(String url, Map<String, dynamic> params,
{Function success, Function failure}) {
_doRequest(url, params, Method.post, success, failure);
}
void _doRequest(String url, Map<String, dynamic> params, Method method,
Function successCallBack, Function failureCallBack) async {
try {
/// header
// if (isIntelligent) {
// dio.options.headers.addAll(await NetHeader.getZnToken());
// } else {
// if (isContentType) {
// dio.options.contentType =
// ContentType.parse("application/x-www-form-urlencoded").toString();
// }
// dio.options.headers.addAll(NetHeader.dmsHeaders);
// }
dio.interceptors.add(interceptors);
Response response;
switch (method) {
case Method.get:
if (params != null && params.isNotEmpty) {
response = await dio.get(url, queryParameters: params);
} else {
response = await dio.get(url);
}
break;
case Method.post:
if (params != null && params.isNotEmpty) {
response = await dio.post(url, data: params);
} else {
response = await dio.post(url);
}
break;
}
Map<String, dynamic> result = json.decode(response.toString());
//
print('''api: $url\nparams: $params\nresult: $result''');
// model
BaseModel model = BaseModel.fromJson(result);
if (model.code == 100 || model.code == 0) {
// 100
if (successCallBack != null) {
//
if (model.result == null) {
successCallBack(model.message);
} else {
successCallBack(model.result);
}
}
} else {
//TODO
//使Toast
//
// GlobalToast.globalToast('${model.message}!~');
if (failureCallBack != null) {
failureCallBack(model.code);
// if (model.code == 1 && model.message == 'token过期') {
// Application.navigatorKey.currentState.pushNamedAndRemoveUntil(
// "/LoginPage", ModalRoute.withName("/"));
// }
// failureCallBack(model.message);
}
}
} catch (exception) {
print('错误:${exception.toString()}');
// FlutterToast.showToast(msg: "请求失败,请稍后再试");
if (failureCallBack != null) {
failureCallBack(exception.toString());
}
}
}
//
// doUploadFile(String url, File file, String loadingText,Function successCallBack,
// Function failureCallBack) async {
// try {
// String timeStamp = DateTime.now().millisecondsSinceEpoch.toString();
// FormData formData = FormData.from({
// 'file': UploadFileInfo(file, '$timeStamp.jpg',
// contentType: ContentType.parse("image/jpeg"))
// });
// Response response = await dio.post(url, data: formData);
// print('$response'); // modeljson
// Map<String, dynamic> result = json.decode(response.toString());
// assert(() {
// // assertdebugrelease
// //
// print('''api: $url\nresult: $result''');
// return true;
// }());
// BaseModel model = BaseModel.fromJson(result);
// if (model.code == 200) {
// // 200
// if (successCallBack != null) {
// if (model.data != null) {
// successCallBack(model.data);
// } else {
// successCallBack({});
// }
// }
// } else {
// //Fluttertoast.showToast(msg: "${model.msg}");
// if (failureCallBack != null) {
// failureCallBack(model.msg);
// }
// }
// } catch (exception) {
// assert(() {
// //
// print('''api: $url\n错误:${exception.toString()}''');
// return true;
// }());
// // Fluttertoast.showToast(msg: '加载失败');
// if (failureCallBack != null) {
// failureCallBack(exception.toString());
// }
// }
// }
}

@ -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);
}
/// spbool
static Future<bool> saveBool(String key, bool value) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return await prefs.setBool(key, value);
}
/// spbool
static Future<bool> getBool(String key) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return prefs.getBool(key);
}
/// spint
static Future<bool> saveInt(String key, int value) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return await prefs.setInt(key, value);
}
/// spint
static Future<int> getInt(String key) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return prefs.getInt(key);
}
/// spdouble
static Future<bool> saveDouble(String key, double value) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return await prefs.setDouble(key, value);
}
/// spdouble
static double getDouble(String key, double defValue) {
if (_prefs == null) return defValue;
return _prefs.getDouble(key) ?? defValue;
}
/// spString
static Future<bool> saveString(String key, String value) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return await prefs.setString(key, value);
}
/// spString
static Future<String> getString(String key) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return prefs.getString(key);
}
/// spList<String>
static Future<bool> saveStrings(String key, List<String> value) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return await prefs.setStringList(key, value);
}
/// spList<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);
}
/// spkey,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…
Cancel
Save