Merge branch 'master' into regex

# Conflicts:
#	lib/pages/market/market_cart_page/widget/market_cart_bottom_bar.dart
#	lib/pages/market/market_cart_page/widget/market_cart_card.dart
#	lib/pages/personal/personal_page.dart
#	lib/pages/setting_page/setting_page.dart
hmxc
张萌 4 years ago
commit 4ddd42701c

@ -1,4 +1,5 @@
import 'package:akuCommunity/pages/tab_navigator.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:ani_route/ani_route.dart';
import 'package:flutter/material.dart';
@ -39,6 +40,7 @@ class _MyAppState extends State<MyApp> {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (context) => CartProvidde()),
ChangeNotifierProvider(create: (context)=>UserProvider()),
],
child: OKToast(
textStyle: TextStyle(fontSize: 19.0, color: Colors.white),

@ -150,7 +150,7 @@ class ProductContent extends StatelessWidget {
Positioned _positionedRecommend() {
return Positioned(
right: ScreenUtil().setWidth(453),
top: ScreenUtil().setWidth(252),
bottom: 100.w,
child: Row(
children: [
Icon(

@ -1,15 +1,95 @@
import 'package:akuCommunity/model/aku_shop_model.dart';
import 'package:akuCommunity/utils/screenutil.dart';
import 'package:akuCommunity/widget/cached_image_wrapper.dart';
import 'package:akuCommunity/widget/cart_count.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:provider/provider.dart';
import 'package:akuCommunity/provider/cart.dart';
import 'package:akuCommunity/routers/page_routers.dart';
import 'package:akuCommunity/model/aku_shop_model.dart';
import 'widget/market_cart_app_bar.dart';
import 'widget/market_cart_card.dart';
import 'widget/market_cart_bottom_bar.dart';
class MarketCartPage extends StatelessWidget {
MarketCartPage({Key key}) : super(key: key);
class MarketCartPage extends StatefulWidget {
final AkuShopModel cartItem;
MarketCartPage({Key key, this.cartItem}) : super(key: key);
@override
_MarketCartPageState createState() => _MarketCartPageState();
}
class _MarketCartPageState extends State<MarketCartPage> {
Widget _cardRadio(
BuildContext context, AkuShopModel cartItem, CartProvidde model, index) {
return InkWell(
onTap: () {
setState(() {
cartItem.isCheck = !cartItem.isCheck;
int _goods = shopList.indexWhere(
(element) => element.itemid == _cartList[index].itemid);
_goods > -1
? shopList.removeAt(_goods)
: shopList.add(_cartList[index]);
print(shopList);
});
},
child: Container(
alignment: Alignment.center,
child: Icon(
Icons.check_circle,
color: cartItem.isCheck ? Color(0xffdb0000) : Color(0xff999999),
size: 36.w,
),
),
);
}
Widget _image(String imagePath) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 20.w),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(2)),
child: CachedImageWrapper(
url: imagePath,
width: 180.w,
height: 180.w,
),
),
);
}
Widget _content(String content, specs, price) {
return Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 394.w,
child: Text(
content,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 24.sp,
color: Color(0xff333333),
),
),
),
Container(
margin: EdgeInsets.only(top: 40.w),
child: Text(
'${price}',
style: TextStyle(
fontSize: 28.sp,
color: Color(0xffe60e0e),
),
),
),
],
),
);
}
// List<Map<String, dynamic>> _listGoods = [
// {
// 'imagePath':
@ -108,36 +188,255 @@ class MarketCartPage extends StatelessWidget {
// // isAll = !isAll;
// // });
// }
List<AkuShopModel> shopList = [];
bool get _selectALl {
for (var element in _cartList) {
int _selectGoods =
shopList.indexWhere((index) => element.itemid == index.itemid);
if (_selectGoods == -1) return false;
}
return true;
}
double get _allprice {
double _price = 0;
for (var element in shopList) {
_price += double.parse(element.itemprice) * element.count;
}
return _price;
}
int get _goodsCount => shopList.length;
List<AkuShopModel> _cartList;
Future<String> _getCartInfo(BuildContext context) async {
await Provider.of<CartProvidde>(context, listen: false).getCartInfo();
await Provider.of<CartProvidde>(context, listen: true).getCartInfo();
return 'end';
}
Widget _selectAll(
CartProvidde model,
) {
return InkWell(
onTap: () {
for (var element in _cartList) {
element.isCheck = !_selectALl;
}
model.changeALlCheckState(true);
setState(() {
if (_selectALl == true)
shopList.clear();
else {
shopList.clear();
shopList.addAll(_cartList);
}
});
},
child: Container(
margin: EdgeInsets.symmetric(vertical: 29.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(
_selectALl
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
color: model.isAllCheck ? Color(0xffdb0000) : Color(0xff999999),
size: 40.w,
),
Container(
margin: EdgeInsets.only(left: 18.w),
child: Text(
'全选',
style: TextStyle(
fontSize: 28.sp,
color: Color(0xff333333),
),
),
),
],
),
),
);
}
Widget _settlement(CartProvidde model, BuildContext context) {
return Row(
children: [
model.allPrice != null
? Container(
margin: EdgeInsets.only(right: 10.w),
child: Text(
'合计:¥${_allprice.toStringAsFixed(2)}',
style: TextStyle(
fontSize: 28.sp,
color: Color(0xffe60e0e),
),
),
)
: SizedBox(),
InkWell(
onTap: model.allGoodsCount != 0 ? () {} : null,
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
color: model.allGoodsCount != 0
? Color(0xffffc40c)
: Color(0xffd8d8d8),
borderRadius: BorderRadius.all(Radius.circular(30)),
),
width: 198.w,
margin: EdgeInsets.symmetric(vertical: 16.w),
padding: EdgeInsets.symmetric(vertical: 12.w),
child: Text(
'结算(${_goodsCount})',
style: TextStyle(
fontSize: 30.sp,
color:
model.allGoodsCount != 0 ? Color(0xff333333) : Colors.white,
),
),
),
),
],
);
}
Widget _marketCartCard(AkuShopModel cartItem, index) {
return Consumer<CartProvidde>(builder: (context, model, child) {
return Container(
margin: EdgeInsets.only(
top: 20.w,
left: 32.w,
right: 32.w,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6)),
),
child: Slidable.builder(
actionPane: SlidableBehindActionPane(),
actionExtentRatio: 0.25,
secondaryActionDelegate: SlideActionBuilderDelegate(
actionCount: 2,
builder: (context, index, animation, renderingMode) {
if (index == 0) {
return SlideAction(
child: Text(
'移至收藏夹',
style: TextStyle(
fontSize: 28.sp, color: Colors.white),
),
color: renderingMode == SlidableRenderingMode.slide
? Color(0xffffc40c).withOpacity(animation.value)
: Color(0xffffc40c),
// onTap: () => _showSnackBar(context, 'More'),
closeOnTap: false,
);
} else {
return SlideAction(
onTap: () {
model.deleteGoods(cartItem.itemid);
},
decoration: BoxDecoration(
color: renderingMode == SlidableRenderingMode.slide
? Color(0xffe60e0e).withOpacity(animation.value)
: Color(0xffe60e0e),
borderRadius: BorderRadius.only(
topRight: Radius.circular(6),
bottomRight: Radius.circular(6),
),
),
child: Text(
'删除',
style: TextStyle(
fontSize: 28.sp, color: Colors.white),
),
// onTap: () => _showSnackBar(context, 'Delete'),
);
}
},
),
child: Container(
color: Colors.white,
padding: EdgeInsets.only(
top: 30.w,
left: 15.w,
bottom: 37.w,
),
child: Stack(
children: [
Row(
children: [
_cardRadio(context, cartItem, model, index),
_image(cartItem.itempic),
_content(cartItem.itemtitle, '默认', cartItem.itemprice),
],
),
Positioned(
bottom: 0,
right: 16.w,
child: CartCount(
cartItem: cartItem,
// goodsNum: widget.goodsNum,
// index: widget.index,
// reduce: widget.reduce,
// add: widget.add,
),
),
],
),
),
),
);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PreferredSize(
child: MarketCartAppBar(),
preferredSize: Size.fromHeight(kToolbarHeight),
child: MarketCartAppBar(),
),
bottomNavigationBar:
Consumer<CartProvidde>(builder: (context, model, child) {
return Container(
color: Colors.white,
height: 98.w,
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_selectAll(model),
_settlement(
model,
context,
)
],
),
);
}),
body: Stack(
children: [
Consumer<CartProvidde>(
builder: (context, model, child) {
List cartList = model.cartList;
List<AkuShopModel> cartList = model.cartList;
_cartList = model.cartList;
return ListView.builder(
itemCount: cartList.length,
itemBuilder: (BuildContext context, int index) {
return MarketCartCard(
cartItem: cartList[index],
);
return _marketCartCard(cartList[index], index);
});
},
),
Positioned(
bottom: 0,
child: MarketCartBottomBar(),
),
// Positioned(
// bottom: 0,
// child: MarketCartBottomBar(
// selectAll: _selectALl,
// ),
// ),
],
));
}

@ -1,4 +1,5 @@
import 'package:akuCommunity/pages/sign/sign_in_page.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:ani_route/ani_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@ -11,6 +12,7 @@ import 'package:akuCommunity/widget/single_ad_space.dart';
import 'package:akuCommunity/widget/cached_image_wrapper.dart';
import 'package:akuCommunity/routers/page_routers.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:provider/provider.dart';
class PersonalIndex extends StatefulWidget {
final bool isSign;
@ -33,6 +35,7 @@ class _PersonalIndexState extends State<PersonalIndex>
}
SliverAppBar _sliverAppBar(double height) {
final userProvider=Provider.of<UserProvider>(context);
return SliverAppBar(
pinned: true,
elevation: 0,
@ -71,18 +74,18 @@ class _PersonalIndexState extends State<PersonalIndex>
'https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1851283359,3457678391&fm=26&gp=0.jpg',
width: 106.w,
height: 106.w,
isSigned: _isSigned,
isSigned: userProvider.isSigned,
),
),
),
InkWell(
onTap: (){
_isSigned? null:ARoute.push(context, SignInPage());
userProvider.isSigned? null:ARoute.push(context, SignInPage());
},
child: Container(
margin: EdgeInsets.only(
left: 16.w),
child: _isSigned
child: userProvider.isSigned
? Text(
'Cheailune',
style: TextStyle(

@ -220,24 +220,24 @@ class _QuestionnaireDetailsPageState extends State<QuestionnaireDetailsPage> {
Container(
padding: EdgeInsets.only(
left: 32.w,
right: Screenutil.length(32),
bottom: Screenutil.length(155),
right: 32.w,
bottom: 155.w,
),
child: ListView(
children: [
Container(
margin: EdgeInsets.only(top: Screenutil.length(24)),
margin: EdgeInsets.only(top: 24.w),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(4)),
borderRadius: BorderRadius.all(Radius.circular(4.w)),
child: CachedImageWrapper(
url: widget.bundle.getMap('details')['imagePath'],
width: Screenutil.length(686),
height: Screenutil.length(228),
width: 686.w,
height: 228.w,
),
),
),
Container(
margin: EdgeInsets.only(top: Screenutil.length(40)),
margin: EdgeInsets.only(top: 40.w),
alignment: Alignment.center,
child: Text(
widget.bundle.getMap('details')['title'],
@ -249,13 +249,13 @@ class _QuestionnaireDetailsPageState extends State<QuestionnaireDetailsPage> {
),
),
Container(
margin: EdgeInsets.only(top: Screenutil.length(35)),
margin: EdgeInsets.only(top: 35.w),
alignment: Alignment.center,
width: Screenutil.length(672),
width: 672.w,
child: Html(data: htmlData),
),
Container(
margin: EdgeInsets.only(top: Screenutil.length(129)),
margin: EdgeInsets.only(top: 129.w),
child: Column(
children: _listQuestion
.map((item) => _questionCard(
@ -267,8 +267,8 @@ class _QuestionnaireDetailsPageState extends State<QuestionnaireDetailsPage> {
),
Container(
margin: EdgeInsets.only(
top: Screenutil.length(80),
bottom: Screenutil.length(24)),
top: 80.w,
bottom: 24.w),
child: Text(
'您的觉得我们需要改进的地方',
style: TextStyle(

@ -1,6 +1,7 @@
import 'dart:async';
import 'package:akuCommunity/pages/setting_page/agreement_page/agreement_page.dart';
import 'package:akuCommunity/pages/sign/sign_in_page.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:ani_route/ani_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@ -10,6 +11,8 @@ import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/widget/common_app_bar.dart';
import 'package:akuCommunity/routers/page_routers.dart';
import 'package:akuCommunity/widget/custom_action_sheet.dart';
import 'package:provider/provider.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'agreement_page/privacy_page.dart';
@ -50,7 +53,7 @@ class _SettingPageState extends State<SettingPage> {
'isSwitch': false,
},
{
'title':'隐私政策',
'title': '隐私政策',
'isSwitch': false,
}
];
@ -179,7 +182,7 @@ class _SettingPageState extends State<SettingPage> {
ARoute.push(context, AgreementPage());
break;
case '隐私政策':
ARoute.push(context,PrivacyPage());
ARoute.push(context, PrivacyPage());
break;
default:
}
@ -233,8 +236,10 @@ class _SettingPageState extends State<SettingPage> {
}
Widget _containerQuit() {
final userProvider = Provider.of<UserProvider>(context);
return InkWell(
onTap: () {
userProvider.isSigned?
showCupertinoModalPopup(
context: context,
builder: (context) {
@ -249,14 +254,16 @@ class _SettingPageState extends State<SettingPage> {
),
),
onPressed: () {
Navigator.popUntil(context, (route) {
return !Navigator.canPop(context);
});
Navigator.pushReplacement(
context,
CupertinoPageRoute(
builder: (context) => SignInPage(),
));
userProvider.setisSigned(false);
ARoute.pop(context);
// Navigator.popUntil(context, (route) {
// return !Navigator.canPop(context);
// });
// Navigator.pushReplacement(
// context,
// CupertinoPageRoute(
// builder: (context) => SignInPage(),
// ));
},
),
],
@ -268,9 +275,10 @@ class _SettingPageState extends State<SettingPage> {
),
);
},
);
):ARoute.push(context, SignInPage());
},
child: Container(
child: userProvider.isSigned
? Container(
color: Colors.white,
height: 96.w,
padding: EdgeInsets.only(
@ -286,6 +294,26 @@ class _SettingPageState extends State<SettingPage> {
color: BaseStyle.color333333,
),
),
)
: Container(
alignment: Alignment.center,
height: 89.w,
width: 586.w,
padding: EdgeInsets.only(
top: 25.w, bottom: 24.w),
margin: EdgeInsets.symmetric(horizontal: 82.w),
decoration: BoxDecoration(
color: Color(0xffffc40c),
borderRadius: BorderRadius.all(Radius.circular(36)),
),
child: Text(
'登录',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: BaseStyle.fontSize28,
color: BaseStyle.color333333,
),
),
),
);
}

@ -1,10 +1,12 @@
import 'package:akuCommunity/pages/tab_navigator.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:ani_route/ani_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:akuCommunity/utils/screenutil.dart';
import 'package:akuCommunity/base/base_style.dart';
import 'package:provider/provider.dart';
class UserAuthenticationPage extends StatefulWidget {
final BuildContext context;
@ -26,6 +28,7 @@ class _UserAuthenticationPageState extends State<UserAuthenticationPage> {
];
AppBar _appBar() {
final userProvider=Provider.of<UserProvider>(context);
return AppBar(
elevation: 0,
backgroundColor: Colors.white,
@ -39,8 +42,9 @@ class _UserAuthenticationPageState extends State<UserAuthenticationPage> {
MaterialButton(
child: Text('跳过'),
onPressed: () {
userProvider.setisSigned(true);
ARoute.pop(context,root: true);
ARoute.pushReplace(context, TabNavigator(isSign: true,));
ARoute.pushReplace(context, TabNavigator());
},
),
],

@ -11,9 +11,7 @@ import 'personal/personal_page.dart';
class TabNavigator extends StatefulWidget {
final bool isSign;
const TabNavigator({Key key, this.isSign=false}) : super(key: key);
const TabNavigator({Key key, }) : super(key: key);
@override
_TabNavigatorState createState() => _TabNavigatorState();
}
@ -37,7 +35,6 @@ _pages=[
PropertyIndex(),
CommunityIndex(),
PersonalIndex(
isSign: widget.isSign,
)
];
}

@ -178,7 +178,7 @@ class _ThingsCreatePageState extends State<ThingsCreatePage> {
alignment: Alignment.center,
height: 98.w,
width: 750.w,
padding: EdgeInsets.symmetric(vertical: Screenutil.length(26.5)),
padding: EdgeInsets.symmetric(vertical:26.5.w),
color: Color(0xffffc40c),
child: Text(
'确认提交',

@ -84,7 +84,7 @@ class _ThingsDetailPageState extends State<ThingsDetailPage> {
alignment: Alignment.center,
height: 98.w,
width: 750.w,
padding: EdgeInsets.symmetric(vertical: Screenutil.length(26.5)),
padding: EdgeInsets.symmetric(vertical: 26.5.w),
color: Color(0xffffc40c),
child: Text(
widget.bundle.getMap('things')['isRepair'] ? '确认完成' : '继续提问',

@ -97,7 +97,7 @@ class GoodsInfoCardButton extends StatelessWidget {
child: Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(
vertical: Screenutil.length(26.5),
vertical: 26.5.w,
),
decoration: BoxDecoration(
border: Border(

@ -118,7 +118,7 @@ class _ThingsEvaluatePageState extends State<ThingsEvaluatePage> {
alignment: Alignment.center,
height: 96.w,
margin: EdgeInsets.symmetric(horizontal: 32.w),
padding: EdgeInsets.symmetric(vertical: Screenutil.length(25.5)),
padding: EdgeInsets.symmetric(vertical: 25.5.w),
decoration: BoxDecoration(
color: Color(0xffffc40c),
borderRadius: BorderRadius.all(Radius.circular(48)),

@ -141,7 +141,7 @@ class _ThingsPageState extends State<ThingsPage> with TickerProviderStateMixin {
alignment: Alignment.center,
height: 98.w,
width: 750.w,
padding: EdgeInsets.symmetric(vertical: Screenutil.length(26.5)),
padding: EdgeInsets.symmetric(vertical: 26.5.w),
color: Color(0xffffc40c),
child: Text(
'新增',

@ -48,7 +48,7 @@ class ThingsAppBar extends StatelessWidget {
fontSize: 28.sp,
),
labelPadding:
EdgeInsets.symmetric(horizontal: Screenutil.length(131.5)),
EdgeInsets.symmetric(horizontal: 131.5.w),
indicatorColor: Color(0xffffc40c),
indicatorSize: TabBarIndicatorSize.label,
indicatorPadding:

@ -167,7 +167,7 @@ class _VisitorPassPageState extends State<VisitorPassPage> {
alignment: Alignment.center,
height: 98.w,
width: 750.w,
padding: EdgeInsets.symmetric(vertical: Screenutil.length(26.5)),
padding: EdgeInsets.symmetric(vertical: 26.5.w),
color: Color(0xffffc40c),
child: Text(
'发送给访客',

@ -110,21 +110,22 @@ class CartProvidde with ChangeNotifier {
///
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();
// 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();
}
///
@ -140,7 +141,8 @@ class CartProvidde with ChangeNotifier {
});
cartString = json.encode(newList).toString();
prefs.setString("cartInfo", cartString);
await getCartInfo();
// await getCartInfo();
notifyListeners();
}
///

@ -0,0 +1,10 @@
import 'package:flutter/material.dart';
class UserProvider extends ChangeNotifier{
//
bool _isSigned =false;
get isSigned => _isSigned;
setisSigned(bool state){
_isSigned=state;
notifyListeners();
}
}

@ -27,7 +27,7 @@ class _BottomButtonState extends State<BottomButton> {
? BaseStyle.color999999
: BaseStyle.colorffc40c,
padding: EdgeInsets.symmetric(
vertical: Screenutil.length(26.5),
vertical: 26.5.w,
),
child: Text(
widget.title,

@ -143,7 +143,7 @@ class CommonAppBar extends StatelessWidget {
fontSize: 28.sp,
),
labelPadding:
EdgeInsets.symmetric(horizontal: Screenutil.length(131.5)),
EdgeInsets.symmetric(horizontal: 131.5.w),
indicatorColor: Color(0xffffc40c),
indicatorSize: TabBarIndicatorSize.label,
indicatorPadding:

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.7+8
version: 1.0.8+9
environment:
sdk: ">=2.7.0 <3.0.0"

Loading…
Cancel
Save