Browse Source

Merge branches 'dev' and 'master' of https://git.lotus-wallet.com/fmk/huixiang_app

 Conflicts:
	lib/community/community_child_page.dart
	lib/community/community_details.dart
	lib/community/community_view/community_dynamic.dart
master
fmk 3 years ago
parent
commit
30c6833729
  1. 5
      lib/community/community_view/community_dynamic.dart
  2. 4
      lib/community/release_dynamic.dart
  3. 265
      lib/home/home_view/activity_list.dart
  4. 106
      lib/home/home_view/coupon.dart
  5. 77
      lib/home/home_view/featured_acticvity.dart
  6. 167
      lib/home/home_view/quick_order.dart
  7. 4
      lib/main.dart
  8. 71
      lib/mine/fans_page.dart
  9. 25
      lib/mine/follow_page.dart
  10. 1
      lib/mine/mine_page.dart
  11. 8
      lib/mine/mine_view/community_follow.dart
  12. 2
      lib/mine/release_page.dart

5
lib/community/community_view/community_dynamic.dart

@ -124,6 +124,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
_deleteDynamic(id) async {
BaseData baseData = await apiService.deleteTrend(id);
if (baseData != null && baseData.isSuccess) {
widget.exitFull();
SmartDialog.showToast("删除成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
@ -314,8 +315,8 @@ class _CommunityDynamic extends State<CommunityDynamic> {
child: MImage(
subjectInfo.images[0],
fit: BoxFit.cover,
width: MediaQuery.of(context).size.width / 2,
height: MediaQuery.of(context).size.width / 2,
width: MediaQuery.of(context).size.width / 1.5,
height: MediaQuery.of(context).size.width / 1.5,
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
),

4
lib/community/release_dynamic.dart

@ -86,7 +86,7 @@ class _ReleaseDynamic extends State<ReleaseDynamic> {
child: Column(
children: [
buildEdit(),
GridView.builder(
Expanded(child: GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 12.w,
@ -110,7 +110,7 @@ class _ReleaseDynamic extends State<ReleaseDynamic> {
: mediaPaths.length >= 9
? 9
: (mediaPaths.length + 1)),
),
),)
],
),
),

265
lib/home/home_view/activity_list.dart

@ -0,0 +1,265 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/main.dart';
import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:keframe/frame_separate_widget.dart';
import 'package:keframe/size_cache_widget.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ActivityList extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _ActivityList();
}
}
class _ActivityList extends State<ActivityList>
with AutomaticKeepAliveClientMixin {
ApiService apiService;
@override
void initState() {
super.initState();
eventBus.on<EventType>().listen((event) {
if (event.type < 3) {
setState(() {});
}
});
}
List<Activity> activityList;
queryActivity() async {
final SharedPreferences value = await SharedPreferences.getInstance();
apiService =
ApiService(Dio(), context: context, token: value.getString('token'));
BaseData<PageInfo<Activity>> baseData = await apiService.informationList({
"pageNum": 1,
"pageSize": 10,
"searchKey": "",
"type": 1,
"state": 1
}).catchError((error) {
_refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
_refreshController.refreshCompleted();
activityList = baseData.data.list;
}
}
@override
void dispose() {
super.dispose();
_refreshController.dispose();
}
RefreshController _refreshController = RefreshController();
@override
Widget build(BuildContext context) {
super.build(context);
return Container(
child: FutureBuilder(
future: queryActivity(),
builder: (context, snapshot) {
return Scaffold(
appBar: MyAppBar(
background: Color(0xFFFFFFFF),
leadingColor: Colors.black,
title:S.of(context).huodongliebiao,
titleColor: Colors.black,
titleSize: 18.sp,
),
body: SizeCacheWidget(
child: SmartRefresher(
controller: _refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
physics: BouncingScrollPhysics(),
onRefresh: () {
setState(() {});
},
child: ListView.builder(
itemCount: activityList == null ? 0 : activityList.length,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return InkWell(
onTap: () {
Navigator.of(context).pushNamed(
'/router/web_page',
arguments: {"activityId": activityList[position].id});
},
child: FrameSeparateWidget(
child: activityItem(activityList[position]),
placeHolder: AspectRatio(
aspectRatio: 1.34,
child: Container(
margin: EdgeInsets.symmetric(
horizontal: 16.w, vertical: 8.h),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(8),
),
),
),
),
);
},
),
),
),
);
},
),
);
}
Widget activityItem(Activity activity) {
return Container(
margin: EdgeInsets.only(
left: 16.w,
right: 16.w,
top: 8.h,
bottom: 12.h,
),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(8),
),
child: Column(
children: [
MImage(
activity.coverImg,
aspectRatio: 2.1,
radius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
fit: BoxFit.cover,
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
),
Container(
padding: EdgeInsets.only(
left: 16.w,
right: 16.w,
top: 8.h,
bottom: 12.h,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
activity.mainTitle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
color: Colors.black,
),
),
SizedBox(
height: 4.h,
),
Text(
activity.viceTitle ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4C4C4C),
),
),
SizedBox(
height: 12.h,
),
ConstrainedBox(
constraints: BoxConstraints(
maxWidth: double.infinity,
minWidth: double.infinity,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
activity.storeName == null ? "" : activity.storeName,
style: TextStyle(
color: Color(0xFF060606),
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
Row(
// crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
activity.startTime.split(" ")[0],
style: TextStyle(
color: Color(0xFFB5B5B5),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(
width: 4.w,
),
Text(
activity.startTime.split(" ")[1],
style: TextStyle(
color: Color(0xFFB5B5B5),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
],
),
],
),
),
],
),
),
],
),
);
}
@override
bool get wantKeepAlive => true;
}

106
lib/home/home_view/coupon.dart

@ -1,11 +1,19 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/coupon.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/item_title.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/receive_success.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:huixiang/view_widget/selector_store_dialog.dart';
import 'package:huixiang/view_widget/separator.dart';
import 'package:shared_preferences/shared_preferences.dart';
class CouponView extends StatefulWidget {
@override
@ -15,6 +23,46 @@ class CouponView extends StatefulWidget {
}
class _CouponView extends State<CouponView> {
ApiService apiService;
int pageNum = 1;
List<Coupon> coupons = [];
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) => {
apiService = ApiService(
Dio(),
context: context,
token: value.getString('token'),
),
queryCoupon(),
});
}
queryCoupon() async {
BaseData<PageInfo<Coupon>> baseData = await apiService.queryCoupon({
"centre": true,
"pageNum": pageNum,
"pageSize": 10,
"searchKey": "",
"state": 0
}).catchError((onError) {
});
if (pageNum == 1) coupons.clear();
if (baseData != null && baseData.isSuccess) {
coupons.addAll(baseData.data.list);
if (baseData.data.pageNum == baseData.data.pages) {
} else {
pageNum += 1;
}
setState(() {});
} else {
}
}
@override
Widget build(BuildContext context) {
return Column(
@ -34,16 +82,16 @@ class _CouponView extends State<CouponView> {
physics: BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 10),
itemBuilder: (context, position) {
return couponItem();
return couponItem(coupons[position]);
},
itemCount: 10,
itemCount:coupons == null ? 0 : coupons.length,
),
),
],
);
}
Widget couponItem() {
Widget couponItem(Coupon coupon) {
return Container(
width: 0.9.sw,
height: 122.h,
@ -97,7 +145,11 @@ class _CouponView extends State<CouponView> {
),
),
TextSpan(
text: "20",
text: coupon != null
? double.tryParse("${coupon.discountAmount}" ?? "0")
.toInt()
.toString()
: "",
style: TextStyle(
fontSize: 25.sp,
fontWeight: MyFontWeight.regular,
@ -108,7 +160,11 @@ class _CouponView extends State<CouponView> {
),
),
Text(
"抵扣劵",
S.of(context).manyuankeyong(coupon != null
? double.tryParse("${coupon.fullAmount}" ?? "0")
.toInt()
.toString()
: ""),
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 14.sp,
@ -141,7 +197,8 @@ class _CouponView extends State<CouponView> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"海峡姐妹(楚河汉街店)",
(coupon != null && coupon.storeList != null && coupon.storeList.length > 0) ? coupon.storeList[0].storeName ?? "" : "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF181818),
fontWeight: MyFontWeight.medium,
@ -150,19 +207,19 @@ class _CouponView extends State<CouponView> {
),
Row(
children: [
// Text(
// "1张",
// style: TextStyle(
// color: Color(0xFF868686),
// fontWeight: MyFontWeight.regular,
// fontSize: 12.sp,
// ),
// ),
// SizedBox(
// width: 4.w,
// ),
Text(
"1张",
style: TextStyle(
color: Color(0xFF868686),
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
SizedBox(
width: 4.w,
),
Text(
"20元无门槛抵扣 ",
coupon != null ? coupon.couponName ?? "" : "",
style: TextStyle(
color: Color(0xFF868686),
fontWeight: MyFontWeight.regular,
@ -179,7 +236,10 @@ class _CouponView extends State<CouponView> {
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"2021/10/11到期",
(coupon.useStartTime == null &&
coupon.useEndTime == null)
? S.of(context).quantian
: "${coupon.useStartTime.replaceAll("-", ".").split(" ")[0]} - ${coupon.useEndTime.replaceAll("-", ".").split(" ")[0]}",
style: TextStyle(
color: Color(0xFF868686),
fontWeight: MyFontWeight.semi_bold,
@ -190,13 +250,17 @@ class _CouponView extends State<CouponView> {
child: Container(),
flex: 1,
),
RoundButton(
GestureDetector(
onTap: (){
},
child:RoundButton(
text: "领取",
textColor: Colors.white,
backgroup: Color(0xFF32A060),
radius: 100,
padding: EdgeInsets.symmetric(vertical: 3.h, horizontal: 14.w),
),
),
SizedBox(
width: 10.w,
),
@ -214,4 +278,6 @@ class _CouponView extends State<CouponView> {
),
);
}
}

77
lib/home/home_view/featured_acticvity.dart

@ -1,8 +1,15 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/item_title.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
class FeaturedActivity extends StatefulWidget {
@override
@ -12,15 +19,48 @@ class FeaturedActivity extends StatefulWidget {
}
class _FeaturedActivity extends State<FeaturedActivity> {
ApiService apiService;
@override
void initState() {
super.initState();
queryActivity();
}
List<Activity> activityList;
queryActivity() async {
final SharedPreferences value = await SharedPreferences.getInstance();
apiService =
ApiService(Dio(), context: context, token: value.getString('token'));
BaseData<PageInfo<Activity>> baseData = await apiService.informationList({
"pageNum": 1,
"pageSize": 10,
"searchKey": "",
"type": 1,
"state": 1
}).catchError((error) {
});
if (baseData != null && baseData.isSuccess) {
activityList = baseData.data.list;
if(activityList != null && activityList.length == 1)
activityList.add(activityList[0]);
if(activityList != null && activityList.length == 2)
activityList.add(activityList[1]);
}
}
@override
Widget build(BuildContext context) {
return Column(
children: [
ItemTitle(
text: S.of(context).jifenshangcheng,
text: "精选活动",
imgPath: "assets/image/icon_points_mall.png",
moreText: S.of(context).chakangengduo,
onTap: () {},
onTap: () {
Navigator.of(context).pushNamed('/router/activity_list');
},
),
SizedBox(
height: 10.h,
@ -29,53 +69,56 @@ class _FeaturedActivity extends State<FeaturedActivity> {
margin: EdgeInsets.symmetric(horizontal: 9.w),
child: Row(
children: [
if(activityList != null && activityList.length > 0)
Container(
child: stackItem(18.sp),
child: stackItem(18.sp,activityList[0]),
margin: EdgeInsets.symmetric(horizontal: 5.w),
width: (MediaQuery.of(context).size.width - 42) / 2,
height: 180.h,
height: 190.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Colors.red,
image: DecorationImage(
image: AssetImage(
"assets/image/share_image_bg.png",
image: NetworkImage(
activityList[0].coverImg,
),
fit: BoxFit.cover,
),
),
),
if(activityList != null && activityList.length > 1)
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
child: stackItem(14.sp),
child: stackItem(12.sp,activityList[1]),
margin: EdgeInsets.symmetric(horizontal: 5.w),
width: (MediaQuery.of(context).size.width - 42) / 2,
height: 170.h / 2,
height: 190.h / 2,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Colors.green,
image: DecorationImage(
image: AssetImage(
"assets/image/share_image_bg.png",
image: NetworkImage(
activityList[1].coverImg,
),
fit: BoxFit.cover,
),
),
),
SizedBox(height: 5,),
Container(
child: stackItem(14.sp),
child: stackItem(12.sp,activityList[2]),
margin: EdgeInsets.symmetric(horizontal: 5.w),
width: (MediaQuery.of(context).size.width - 42) / 2,
height: 170.h / 2,
height: 190.h / 2,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Colors.blue,
image: DecorationImage(
image: AssetImage(
"assets/image/share_image_bg.png",
image: NetworkImage(
activityList[2].coverImg,
),
fit: BoxFit.cover,
),
@ -94,7 +137,7 @@ class _FeaturedActivity extends State<FeaturedActivity> {
);
}
Widget stackItem(double textSize) {
Widget stackItem(double textSize,Activity activity) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
@ -105,7 +148,7 @@ class _FeaturedActivity extends State<FeaturedActivity> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"第二件半价!",
activity.mainTitle,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: textSize,
@ -116,7 +159,7 @@ class _FeaturedActivity extends State<FeaturedActivity> {
height: 2,
),
Text(
"仅限指定饮品",
activity.viceTitle,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 12.sp,

167
lib/home/home_view/quick_order.dart

@ -1,9 +1,18 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart';
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/location.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/store.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/item_title.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
class QuickOrder extends StatefulWidget {
@override
@ -13,6 +22,133 @@ class QuickOrder extends StatefulWidget {
}
class _QuickOrder extends State<QuickOrder> {
ApiService apiService;
List<Store> storeList;
BMFCoordinate latLng;
BMFMapController _mapController;
final TextEditingController editingController = TextEditingController();
@override
void initState() {
super.initState();
getLatLng();
startLocation();
}
///
queryStore(latitude, longitude, province, city, district, searchKey) async {
BaseData<List<Store>> baseData = await apiService.queryStore({
// "city": city,
// "district": district,
// "province": province,
"latitude": latitude,
"longitude": longitude,
"searchKey": searchKey
}).catchError((error) {
});
if (baseData != null && baseData.isSuccess) {
storeList = baseData.data;
}
setState(() {});
}
getLatLng() async {
SharedPreferences.getInstance().then(
(value) => {
apiService = ApiService(Dio(),
context: context,
token: value.getString('token'),
showLoading: false),
if (value.containsKey("latitude") &&
value.containsKey("longitude") &&
value.containsKey("province") &&
value.containsKey("city") &&
value.containsKey("district"))
{
latLng = BMFCoordinate(double.tryParse(value.getString("latitude")),
double.tryParse(value.getString("longitude"))),
queryStore(
value.getString("latitude"),
value.getString("longitude"),
value.getString("province"),
value.getString("city"),
value.getString("district"),
editingController.text,
),
setState(() {
if (_mapController != null) {
_mapController.updateMapOptions(BMFMapOptions(
center: latLng,
zoomLevel: 15,
));
}
})
}
else
{
queryStore("", "", "", "", "", editingController.text),
}
},
);
}
startLocation() async {
Location.getInstance()
.aMapFlutterLocation
.onResultCallback()
.listen((event) {
if (event != null &&
event["latitude"] != null &&
event["longitude"] != null) {
print("location: $event");
if (event["latitude"] is String && event["longitude"] is String) {
latLng = BMFCoordinate(double.tryParse(event["latitude"]),
double.tryParse(event["longitude"]));
} else {
latLng = BMFCoordinate(event["latitude"], event["longitude"]);
}
BMFCalculateUtils.coordConvert(
coordinate: latLng,
fromType: BMF_COORD_TYPE.BD09LL,
toType: BMF_COORD_TYPE.COMMON)
.then((value) {
this.latLng = value;
saveLatLng(
value, event["province"], event["city"], event["district"]);
print("union: Location result ${value.latitude} "
"${value.longitude}");
Location.getInstance().stopLocation();
queryStore(
"${value.latitude}",
"${value.longitude}",
event["province"],
event["city"],
event["district"],
editingController.text);
if (_mapController != null)
_mapController.updateMapOptions(BMFMapOptions(
center: value,
zoomLevel: 15,
));
});
}
});
Location.getInstance().prepareLoc();
Location.getInstance().startLocation(context).then((value) {
});
}
saveLatLng(BMFCoordinate latLng, province, city, district) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString("latitude", "${latLng.latitude}");
await prefs.setString("longitude", "${latLng.longitude}");
if (province != null) await prefs.setString("province", province);
if (city != null) await prefs.setString("city", city);
if (district != null) await prefs.setString("district", district);
}
@override
Widget build(BuildContext context) {
return Column(
@ -28,17 +164,29 @@ class _QuickOrder extends State<QuickOrder> {
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 10),
itemCount:storeList == null ? 0 : storeList.length,
itemBuilder: (context, position) {
return storeItem();
return GestureDetector(
onTap: () {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": storeList[position].id,
"tenant": storeList[position].tenantCode,
"storeName": storeList[position].storeName
},
);
},
child: storeItem(storeList[position],position),
);
},
itemCount: 10,
),
),
],
);
}
Widget storeItem() {
Widget storeItem(Store store,position) {
return Container(
width: 160,
height: 160,
@ -96,13 +244,16 @@ class _QuickOrder extends State<QuickOrder> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/default_user.png",
MImage(
store.logo,
width: 32,
height: 32,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
Text(
"百年川椒",
store.storeName,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
@ -110,7 +261,7 @@ class _QuickOrder extends State<QuickOrder> {
),
),
Text(
"正宗重庆老味道",
store?.remark ??"",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.medium,

4
lib/main.dart

@ -71,6 +71,7 @@ import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'home/guide_page.dart';
import 'home/home_view/activity_list.dart';
import 'main_page.dart';
import 'mine/fans_page.dart';
import 'mine/follow_page.dart';
@ -305,7 +306,6 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/test_page': (context, {arguments}) => TestPage(),
// '/router/ui_test': (context, {arguments}) => UITest(),
'/router/communityFollow': (context, {arguments}) => CommunityFollow(),
'/router/followPage': (context, {arguments}) => FollowPage(),
'/router/fansPage': (context, {arguments}) => FansPage(),
'/router/releasePage': (context, {arguments}) => ReleasePage(),
'/router/activity_list': (context, {arguments}) => ActivityList(),
};

71
lib/mine/fans_page.dart

@ -1,7 +1,9 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/data/follow_list.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
@ -9,11 +11,18 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class FansPage extends StatefulWidget {
final Function refresh;
FansPage(
this.refresh
);
@override
State<StatefulWidget> createState() {
return _FansPage();
@ -72,6 +81,17 @@ class _FansPage extends State<FansPage> {
}
}
///
_vipFollow(followId) async {
BaseData baseData = await apiService.follow(followId);
if (baseData != null && baseData.isSuccess) {
widget.refresh();
SmartDialog.showToast("关注成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -98,8 +118,7 @@ class _FansPage extends State<FansPage> {
scrollDirection: Axis.vertical,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
onTap: () {},
child: fansItem(list[position]),
);
},
@ -115,7 +134,6 @@ class _FansPage extends State<FansPage> {
);
}
Widget fansItem(ListData list) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h),
@ -135,7 +153,9 @@ class _FansPage extends State<FansPage> {
SizedBox(
width: 8,
),
Expanded(child:Text(
Expanded(
flex: 1,
child: Text(
list != null ? (list.nickname ?? "") : "",
style: TextStyle(
color: Color(0xFF1A1A1A),
@ -150,7 +170,48 @@ class _FansPage extends State<FansPage> {
borderRadius: BorderRadius.circular(11.w),
color: Color(0xFF32A060),
),
child:Row(
child:
// GestureDetector(
// onTap: () {
// setState(() {
// if (widget.commentType == 0) {
// comment?.selfFollow =
// !(comment?.selfFollow ?? false);
// _vipFollow(list.mid);
// }
// });
// },
// child: (widget.commentType == 0)
// ? RoundButton(
// padding: EdgeInsets.symmetric(
// horizontal: 8,
// vertical: 3,
// ),
// backgroup: (comment?.selfFollow ?? false)
// ? Color(0xFFE6E6E6)
// : Color(0xFF32A060),
// textColor: (comment?.selfFollow ?? false)
// ? Color(0xFF808080)
// : Colors.white,
// text: (comment?.selfFollow ?? false) ? "已关注" : "关注",
// radius: 20,
// icons: Icon(
// (comment?.selfFollow ?? false)
// ? Icons.check
// : Icons.add,
// color: (comment?.selfFollow ?? false)
// ? Color(0xFF808080)
// : Colors.white,
// size: 14,
// ),
// )
// : Icon(
// Icons.close,
// color: Colors.black,
// size: 16,
// ),
// ),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment:CrossAxisAlignment.center,
children: [

25
lib/mine/follow_page.dart

@ -1,6 +1,7 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/follow_list.dart';
@ -17,6 +18,12 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class FollowPage extends StatefulWidget {
final Function refresh;
FollowPage(
this.refresh
);
@override
State<StatefulWidget> createState() {
return _FollowPage();
@ -75,6 +82,18 @@ class _FollowPage extends State<FollowPage> {
}
}
////
_vipFollow(followId) async {
BaseData baseData = await apiService.follow(followId);
if (baseData != null && baseData.isSuccess) {
widget.refresh();
_queryFollowList();
SmartDialog.showToast("取关成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -152,6 +171,10 @@ class _FollowPage extends State<FollowPage> {
borderRadius: BorderRadius.circular(11.w),
color: Color(0xFFE6E6E6),
),
child:
GestureDetector(onTap: (){
_vipFollow(list.mid);
},
child:Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment:CrossAxisAlignment.center,
@ -173,7 +196,7 @@ class _FollowPage extends State<FollowPage> {
),
),
],
),
),),
),
],
),

1
lib/mine/mine_page.dart

@ -7,6 +7,7 @@ import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/main.dart';
import 'package:huixiang/mine/mine_view/mine_order.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/data/rank.dart';
import 'package:huixiang/retrofit/data/sign_info.dart';
import 'package:huixiang/retrofit/data/social_info.dart';

8
lib/mine/mine_view/community_follow.dart

@ -4,17 +4,18 @@ import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/mine/follow_page.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/data/social_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/my_tab.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../fans_page.dart';
class CommunityFollow extends StatefulWidget {
@override
State<StatefulWidget> createState() {
@ -53,6 +54,7 @@ class _CommunityFollow extends State<CommunityFollow>
EasyLoading.dismiss();
}
@override
Widget build(BuildContext context) {
return DefaultTabController(
@ -88,7 +90,7 @@ class _CommunityFollow extends State<CommunityFollow>
),
),
body: TabBarView(
children: [FollowPage(),FansPage()],
children: [FollowPage((){querySocialInfo();}),FansPage((){querySocialInfo();})],
),
),
);

2
lib/mine/release_page.dart

@ -109,7 +109,7 @@ class _ReleasePage extends State<ReleasePage> {
child: CommunityDynamic(
comments[position],
1,exitFull: (){setState(() {
_onRefresh();
});},
removalDynamic: () {
_onRefresh();

Loading…
Cancel
Save