Browse Source

safety

master
fmk 3 years ago
parent
commit
7ab83047cd
  1. 2
      lib/main.dart
  2. 103
      lib/store/store_order.dart
  3. 29
      lib/store/store_view/store_order_list.dart
  4. 81
      lib/test_page.dart
  5. 12
      pubspec.lock
  6. 4
      pubspec.yaml

2
lib/main.dart

@ -55,6 +55,7 @@ import 'package:huixiang/setting/treaty_page.dart';
// import 'package:huixiang/store/settlement.dart'; // import 'package:huixiang/store/settlement.dart';
import 'package:huixiang/store/store_order.dart'; import 'package:huixiang/store/store_order.dart';
import 'package:huixiang/store/store_view/settlement.dart'; import 'package:huixiang/store/store_view/settlement.dart';
import 'package:huixiang/test_page.dart';
import 'package:huixiang/union/location_map_page.dart'; import 'package:huixiang/union/location_map_page.dart';
import 'package:huixiang/web/web_page.dart'; import 'package:huixiang/web/web_page.dart';
@ -264,5 +265,6 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/about_page': (context, {arguments}) => AboutPage(), '/router/about_page': (context, {arguments}) => AboutPage(),
'/router/qr_share': (context, {arguments}) => QrSharePage(), '/router/qr_share': (context, {arguments}) => QrSharePage(),
'/router/main_page': (context, {arguments}) => MainPage(), '/router/main_page': (context, {arguments}) => MainPage(),
'/router/test_page': (context, {arguments}) => TestPage(),
// '/router/ui_test': (context, {arguments}) => UITest(), // '/router/ui_test': (context, {arguments}) => UITest(),
}; };

103
lib/store/store_order.dart

@ -44,6 +44,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
RefreshController refreshController; RefreshController refreshController;
List<Widget> _widgetOptions; List<Widget> _widgetOptions;
ScrollController controller = ScrollController();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -70,14 +72,16 @@ class _StoreOrderPage extends State<StoreOrderPage>
/// ///
minLogin() { minLogin() {
apiService.minLogin(widget.arguments["id"]) apiService
.catchError((onError){}).then((baseData) { .minLogin(widget.arguments["id"])
.catchError((onError) {})
.then((baseData) {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
UserEntity userEntity = UserEntity.fromJson(baseData.data); UserEntity userEntity = UserEntity.fromJson(baseData.data);
String minToken = userEntity.token; String minToken = userEntity.token;
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then((value) => {
value.setString('minToken', minToken), value.setString('minToken', minToken),
}); });
minService = MinApiService( minService = MinApiService(
Dio(), Dio(),
context: context, context: context,
@ -114,8 +118,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
} }
} }
ScrollController controller = ScrollController();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Stack( return Stack(
@ -146,16 +148,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
SliverOverlapAbsorber( SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverAppBar( sliver: SliverAppBar(
title: Text(
storeInfo != null
? storeInfo.storeName
: '',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 18.sp,
),
),
expandedHeight: (storeInfo != null && expandedHeight: (storeInfo != null &&
storeInfo.couponVOList != null) storeInfo.couponVOList != null)
? 425.h ? 425.h
@ -164,10 +156,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
snap: false, snap: false,
pinned: true, pinned: true,
stretch: false, stretch: false,
onStretchTrigger: () {
return Future.sync((){});
},
stretchTriggerOffset: 100,
leading: GestureDetector( leading: GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -184,17 +172,10 @@ class _StoreOrderPage extends State<StoreOrderPage>
), ),
), ),
flexibleSpace: FlexibleSpaceBar( flexibleSpace: FlexibleSpaceBar(
// title: Container( title: Title(
// margin: EdgeInsets.only(bottom: 40), controller,
// child: Text( storeInfo != null ? storeInfo.storeName : '',
// 'Expanded Title', ),
// style: TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.bold,
// fontSize: 18.sp,
// ),
// ),
// ),
collapseMode: CollapseMode.pin, collapseMode: CollapseMode.pin,
stretchModes: [ stretchModes: [
StretchMode.zoomBackground, StretchMode.zoomBackground,
@ -264,7 +245,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
bottom: PreferredSize( bottom: PreferredSize(
preferredSize: Size( preferredSize: Size(
MediaQuery.of(context).size.width, MediaQuery.of(context).size.width,
38.h, 38,
), ),
child: Container( child: Container(
padding: EdgeInsets.symmetric(horizontal: 10.w), padding: EdgeInsets.symmetric(horizontal: 10.w),
@ -540,6 +521,10 @@ class _StoreOrderPage extends State<StoreOrderPage>
backgroup: Color(0xFF32A060), backgroup: Color(0xFF32A060),
fontSize: 12.sp, fontSize: 12.sp,
radius: 100, radius: 100,
callback: () {
Navigator.of(context)
.pushNamed('/router/test_page');
},
), ),
), ),
], ],
@ -670,3 +655,57 @@ class _StoreOrderPage extends State<StoreOrderPage>
// @override // @override
// bool get wantKeepAlive => true; // bool get wantKeepAlive => true;
} }
class Title extends StatefulWidget {
final ScrollController controller;
final String title;
Title(this.controller, this.title);
@override
State<StatefulWidget> createState() {
return _Title();
}
}
class _Title extends State<Title> {
double alpha = 0;
@override
void initState() {
super.initState();
widget.controller.addListener(() {
double maxScrollExtent = widget.controller.position.maxScrollExtent;
double alphaHeight = (kToolbarHeight) / 2;
double alphaProgress = maxScrollExtent - widget.controller.offset;
double alphatemp = 0;
if (alphaProgress <= 1) {
alphatemp = 1;
} else if (alphaProgress <= alphaHeight) {
alphatemp = (((alphaHeight - alphaProgress) / alphaHeight) > 0.5) ? 1 : 0;
} else {
alphatemp = 0;
}
if (alpha != alphatemp && mounted) {
alpha = alphatemp;
setState(() {});
}
});
}
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(bottom: 38),
child: Text(
widget.title ?? "",
style: TextStyle(
color: Colors.black.withOpacity(alpha),
fontWeight: FontWeight.bold,
fontSize: 18.sp,
),
),
);
}
}

29
lib/store/store_view/store_order_list.dart

@ -45,11 +45,31 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
int isChoice = 0; int isChoice = 0;
int tempClickIndex = 0; int tempClickIndex = 0;
ScrollController controller1 = ScrollController();
ScrollController controller2 = ScrollController();
bool scrollEnable = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
widget.controller.addListener(() {}); // widget.controller.addListener(() {
// double maxScrollExtent = widget.controller.position.maxScrollExtent;
// bool scrollEnableTemp ;
// if (mounted) {
// if ((maxScrollExtent - widget.controller.offset) == 0) {
// scrollEnableTemp = true;
// } else {
// scrollEnableTemp = false;
// }
// if (scrollEnableTemp != scrollEnable) {
// scrollEnable = scrollEnableTemp;
// setState(() {});
// }
// }
// });
} }
@override @override
@ -67,7 +87,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
child: ListView.builder( child: ListView.builder(
itemCount: 28, itemCount: 28,
padding: EdgeInsets.only(top: 25, bottom: 50), padding: EdgeInsets.only(top: 25, bottom: 50),
controller: widget.controller, controller: controller1,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return orderItem(position); return orderItem(position);
}, },
@ -78,7 +98,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
child: ListView.builder( child: ListView.builder(
itemCount: 15, itemCount: 15,
padding: EdgeInsets.only(top: 25, bottom: 50), padding: EdgeInsets.only(top: 25, bottom: 50),
// controller: widget.controller, // controller: controller2,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return goodsItem(); return goodsItem();
}, },
@ -89,9 +109,6 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
); );
} }
ScrollController controller1 = ScrollController();
ScrollController controller2 = ScrollController();
Widget orderItem(int index) { Widget orderItem(int index) {
return Container( return Container(
child: Column( child: Column(

81
lib/test_page.dart

@ -0,0 +1,81 @@
import 'package:flutter/material.dart';
class TestPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _TestPage();
}
}
class _TestPage extends State<TestPage> {
// ZefyrController controller = ZefyrController(NotusDocument.fromDelta(null));
// FocusNode focusNode = FocusNode();
@override
Widget build(BuildContext context) {
//
// final theme = ZefyrThemeData(
// toolbarTheme: ToolbarTheme.fallback(context),
// );
return Scaffold(
// resizeToAvoidBottomInset: true,
// appBar: AppBar(
// elevation: 1.0,
// backgroundColor: Colors.grey.shade200,
// brightness: Brightness.light,
// title: Text("data"),
// ),
// body: ZefyrScaffold(
// child: ZefyrTheme(
// data: theme,
// child: ZefyrEditor(
// controller: controller,
// focusNode: focusNode,
// imageDelegate: CustomImageDelegate(),
// ),
// ),
// ),
);
}
}
// class CustomImageDelegate implements ZefyrImageDelegate<String> {
// String url = "";
//
// @override
// Future<String> pickImage(String source) async {
// // final file = await ImagePicker.pickImage(source: source);
// // if (file == null) return null;
// // // Use my storage service to upload selected file. The uploadImage method
// // // returns unique ID of newly uploaded image on my server.
// //
// // //
// // var request = await requestfile("url",file, null);
// // print(request);
// // if(request["code"] == "200") {
// // print("图片上传成功");
// // } else {
// // print("图片上传失败");
// // }
// // url = "$SERVER_URL/static/articlePictre/${request["data"]}";
// return url;
// }
//
// @override
// Widget buildImage(BuildContext context, String imageSource) {
// // We use custom "asset" scheme to distinguish asset images from other files.
// print("imageSource is $imageSource");
// // return url delta 使url imageSource
// return Image.network(imageSource);
// }
//
// @override
// String get cameraSource => url;
//
// @override
// String get gallerySource => url;
//
// }

12
pubspec.lock

@ -986,42 +986,42 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "6.0.5" version: "5.7.10"
url_launcher_linux: url_launcher_linux:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_linux name: url_launcher_linux
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.2" version: "0.0.1+4"
url_launcher_macos: url_launcher_macos:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_macos name: url_launcher_macos
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.2" version: "0.0.1+9"
url_launcher_platform_interface: url_launcher_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_platform_interface name: url_launcher_platform_interface
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "1.0.9"
url_launcher_web: url_launcher_web:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_web name: url_launcher_web
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.4" version: "0.1.5+3"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_windows name: url_launcher_windows
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.2" version: "0.0.1+3"
uuid: uuid:
dependency: transitive dependency: transitive
description: description:

4
pubspec.yaml

@ -56,7 +56,7 @@ dependencies:
barcode_widget: ^2.0.1 barcode_widget: ^2.0.1
flutter_qr_reader: ^1.0.5 flutter_qr_reader: ^1.0.5
qr_flutter: ^4.0.0 qr_flutter: ^4.0.0
url_launcher: ^6.0.5 url_launcher: ^5.0.0
image_cropper: ^1.4.1 image_cropper: ^1.4.1
image_picker_gallery_camera: ^0.1.6 image_picker_gallery_camera: ^0.1.6
@ -87,6 +87,8 @@ dependencies:
# flutter_bugly: ^0.3.3 # flutter_bugly: ^0.3.3
# bitmap: ^0.1.2 # bitmap: ^0.1.2
# zefyr: ^0.12.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter

Loading…
Cancel
Save