Browse Source

Merge branch 'master' into dev

master
w-R 3 years ago
parent
commit
6f918592db
  1. 41
      lib/home/activity_list_page.dart
  2. 4
      lib/login/login_page.dart
  3. 41
      lib/main_page.dart
  4. 8
      lib/mine/mine_page.dart
  5. 5
      lib/retrofit/retrofit_api.dart
  6. 2
      lib/union/store_details_page.dart
  7. 32
      lib/union/union_details_page.dart
  8. 1
      lib/view_widget/store_title_tab.dart

41
lib/home/activity_list_page.dart

@ -70,25 +70,20 @@ class _ActivityListPage extends State<ActivityListPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return Container( return Container(
child: SizeCacheWidget( child: FutureBuilder(
child: SmartRefresher( future: queryActivity(),
controller: _refreshController, builder: (context, snapshot) {
enablePullDown: true, return SizeCacheWidget(
enablePullUp: false, child: SmartRefresher(
header: MyHeader(), controller: _refreshController,
physics: BouncingScrollPhysics(), enablePullDown: true,
footer: CustomFooter( enablePullUp: false,
builder: (context, mode) { header: MyHeader(),
return MyFooter(mode); physics: BouncingScrollPhysics(),
}, onRefresh: () {
), setState(() {});
onRefresh: () { },
setState(() {}); child: ListView.builder(
},
child: FutureBuilder(
future: queryActivity(),
builder: (context, snapshot) {
return ListView.builder(
itemCount: activityList == null ? 0 : activityList.length, itemCount: activityList == null ? 0 : activityList.length,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
@ -121,10 +116,10 @@ class _ActivityListPage extends State<ActivityListPage>
), ),
); );
}, },
); ),
}, ),
) );
), },
), ),
); );
} }

4
lib/login/login_page.dart

@ -286,10 +286,6 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
saveUserJson(value.data); saveUserJson(value.data);
eventBus.fire(EventType(3)); eventBus.fire(EventType(3));
xgFlutterPlugin.setAccount(mobile, AccountType.CUSTOM);
xgFlutterPlugin.bindWithIdentifier(
identify: mobile, bindType: XGBindType.account);
Navigator.of(context) Navigator.of(context)
.pushNamedAndRemoveUntil('/router/main_page', (route) => false); .pushNamedAndRemoveUntil('/router/main_page', (route) => false);
} else { } else {

41
lib/main_page.dart

@ -9,6 +9,7 @@ import 'package:huixiang/home/main_home_page.dart';
import 'package:huixiang/main.dart'; import 'package:huixiang/main.dart';
import 'package:huixiang/mine/mine_page.dart'; import 'package:huixiang/mine/mine_page.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/union/union_page.dart'; import 'package:huixiang/union/union_page.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -17,6 +18,7 @@ import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/native_event_handler.dart'; import 'package:huixiang/utils/native_event_handler.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
class MainPage extends StatefulWidget { class MainPage extends StatefulWidget {
@override @override
@ -58,11 +60,10 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
super.initState(); super.initState();
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
EasyLoading.instance EasyLoading.instance
..indicatorType = EasyLoadingIndicatorType.circle ..indicatorType = EasyLoadingIndicatorType.circle
// ..indicatorType = EasyLoadingIndicatorType.wave // ..indicatorType = EasyLoadingIndicatorType.wave
// ..indicatorType = EasyLoadingIndicatorType.threeBounce // ..indicatorType = EasyLoadingIndicatorType.threeBounce
..loadingStyle = EasyLoadingStyle.dark ..loadingStyle = EasyLoadingStyle.dark
..indicatorSize = 35.0 ..indicatorSize = 35.0
..backgroundColor = Colors.white ..backgroundColor = Colors.white
@ -71,7 +72,6 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
..userInteractions = false ..userInteractions = false
..dismissOnTap = false; ..dismissOnTap = false;
pushRoute(); pushRoute();
_widgetOptions = <Widget>[ _widgetOptions = <Widget>[
@ -122,12 +122,15 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
: (event["xg"]["msgtype"] == 1) && : (event["xg"]["msgtype"] == 1) &&
event[Platform.isAndroid ? "customMessage" : "custom"] != null) { event[Platform.isAndroid ? "customMessage" : "custom"] != null) {
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
value.setString("pushData", event[Platform.isAndroid ? "customMessage" : "custom"]); value.setString("pushData",
event[Platform.isAndroid ? "customMessage" : "custom"]);
}); });
if (ModalRoute.of(context).isActive && ModalRoute.of(context).isCurrent) { if (ModalRoute.of(context).isActive &&
ModalRoute.of(context).isCurrent) {
pushRoute(); pushRoute();
} else { } else {
Navigator.of(context).pushNamedAndRemoveUntil('/router/main_page', (route) => false); Navigator.of(context)
.pushNamedAndRemoveUntil('/router/main_page', (route) => false);
} }
} }
return event; return event;
@ -137,7 +140,14 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
}, onReceiveMessage: (event) async { }, onReceiveMessage: (event) async {
print("onReceiveMessage: ${event.toString()}"); print("onReceiveMessage: ${event.toString()}");
return event; return event;
}); }, onRegisteredDone: (event) async {
print("onRegisteredDone: ${event.toString()}");
return event;
}, xgPushDidBindWithIdentifier: (event) async {
print("xgPushDidBindWithIdentifier: ${event.toString()}");
return event;
}
);
} }
pushRoute() async { pushRoute() async {
@ -192,10 +202,18 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (sharedPreferences.getString("token") == null || if (sharedPreferences.getString("token") == null ||
sharedPreferences.getString("token") == "") return; sharedPreferences.getString("token") == "") return;
BaseData baseDate = await ApiService(Dio(), BaseData<UserInfo> baseDate = await ApiService(Dio(),
context: context, token: sharedPreferences.getString('token')) context: context, token: sharedPreferences.getString('token'))
.queryInfo(); .queryInfo();
sharedPreferences.setString('user', jsonEncode(baseDate.data)); sharedPreferences.setString('user', jsonEncode(baseDate.data));
String mobile = baseDate.data.phone;
if (mobile != null && mobile != "") {
xgFlutterPlugin.setAccount(mobile, AccountType.PHONE_NUMBER);
// xgFlutterPlugin.unbindWithIdentifier(identify: mobile, bindType: XGBindType.account)
xgFlutterPlugin.bindWithIdentifier(
identify: mobile, bindType: XGBindType.account);
}
} }
requestPermission() async { requestPermission() async {
@ -234,9 +252,8 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
spreadRadius: 0, spreadRadius: 0,
) )
], ],
borderRadius: BorderRadius.only( borderRadius: BorderRadius.vertical(
topRight: Radius.circular(4), top: Radius.circular(4),
topLeft: Radius.circular(4),
), ),
), ),
height: 82.h, height: 82.h,

8
lib/mine/mine_page.dart

@ -43,7 +43,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
return; return;
} }
await Navigator.of(context).pushNamed('/router/user_info_page'); await Navigator.of(context).pushNamed('/router/user_info_page');
queryUserInfo(); setState(() {});;
} }
loginTips() { loginTips() {
@ -76,7 +76,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
setState(() {}); setState(() {});
} }
if (event.type == 3) { if (event.type == 3) {
queryUserInfo(); setState(() {});;
} }
}); });
} }
@ -559,7 +559,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
Widget mineView() { Widget mineView() {
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.only(left: 16.w, right: 16.w), margin: EdgeInsets.symmetric(horizontal: 16.w),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -700,7 +700,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
return; return;
} }
await Navigator.of(context).pushNamed('/router/integral_page'); await Navigator.of(context).pushNamed('/router/integral_page');
queryUserInfo(); setState(() {});;
} }
@override @override

5
lib/retrofit/retrofit_api.dart

@ -41,6 +41,11 @@ part 'retrofit_api.g.dart';
const base_url = "https://pos.platform.lotus-wallet.com/app/"; /// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///
const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; /// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///
// const base_url = "http://192.168.10.236:8766/app/";
// const baseUrl = "http://192.168.10.236:8766/app/";
// const base_url = "http://192.168.10.74:8766/app/";
// const baseUrl = "http://192.168.10.74:8766/app/";
@RestApi(baseUrl: baseUrl) @RestApi(baseUrl: baseUrl)
abstract class ApiService { abstract class ApiService {

2
lib/union/store_details_page.dart

@ -355,7 +355,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
children: [ children: [
InkWell( InkWell(
child: Text( child: Text(
"${activity != null ? activity.storeName : (article != null && article.author != null) ? article.author.name : ""}", "${activity != null ? (activity.storeName ?? "") : (article != null && article.author != null) ? (article.author.name ?? "") : ""}",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: 14.sp, fontSize: 14.sp,

32
lib/union/union_details_page.dart

@ -78,18 +78,20 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return FutureBuilder(
appBar: MyAppBar( future: queryStoreInfo(),
background: Color(0xFFF7F7F7), builder: (context, snapshot) {
title: storeInfo == null ? widget.arguments["storeName"] : storeInfo.storeName, return Scaffold(
titleColor: Colors.black87, appBar: MyAppBar(
titleSize: 18.sp, background: Color(0xFFF7F7F7),
leadingColor: Colors.black, title: storeInfo == null
), ? (widget.arguments["storeName"] ?? "")
body: FutureBuilder( : storeInfo.storeName,
future: queryStoreInfo(), titleColor: Colors.black87,
builder: (context, snapshot) { titleSize: 18.sp,
return Column( leadingColor: Colors.black,
),
body: Column(
children: [ children: [
Expanded( Expanded(
child: SmartRefresher( child: SmartRefresher(
@ -356,9 +358,9 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
), ),
), ),
], ],
); ),
}, );
), },
); );
} }

1
lib/view_widget/store_title_tab.dart

@ -140,6 +140,7 @@ class _StoreTitleTab extends State<StoreTitleTab> {
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
controller: scrollController, controller: scrollController,
physics: BouncingScrollPhysics(),
child: Container( child: Container(
height: 52.h, height: 52.h,
constraints: BoxConstraints(minWidth: MediaQuery.of(context).size.width), constraints: BoxConstraints(minWidth: MediaQuery.of(context).size.width),

Loading…
Cancel
Save