kotlin ver 1.4.10

update ui
hmxc
小赖 4 years ago
parent c0dd01cf01
commit dd103d1ecf

@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.11'
ext.kotlin_version = '1.4.10'
repositories {
// google()
// jcenter()

@ -1,8 +1,5 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:barcode_scan/barcode_scan.dart';
import 'package:akuCommunity/utils/screenutil.dart';
import 'package:akuCommunity/widget/bottom_button.dart';
import 'package:akuCommunity/widget/cached_image_wrapper.dart';
@ -137,77 +134,11 @@ class _GoodsManagePageState extends State<GoodsManagePage> {
bottom: 0,
child: BottomButton(
title: '扫一扫出借',
fun: () {
scan();
},
fun: () {},
),
),
],
),
);
}
ScanResult scanResult;
final _flashOnController = TextEditingController(text: "打开闪光灯");
final _flashOffController = TextEditingController(text: "关闭闪光灯");
final _cancelController = TextEditingController(text: "关闭");
var _aspectTolerance = 0.00;
var numberOfCameras = 0;
var _selectedCamera = -1;
var _useAutoFocus = true;
var _autoEnableFlash = false;
static final _possibleFormats = BarcodeFormat.values.toList()
..removeWhere((e) => e == BarcodeFormat.unknown);
List<BarcodeFormat> selectedFormats = [..._possibleFormats];
void initState() {
super.initState();
Future.delayed(Duration.zero, () async {
numberOfCameras = await BarcodeScanner.numberOfCameras;
setState(() {});
});
}
Future scan() async {
try {
var options = ScanOptions(
strings: {
"cancel": _cancelController.text,
"flash_on": _flashOnController.text,
"flash_off": _flashOffController.text,
},
restrictFormat: selectedFormats,
useCamera: _selectedCamera,
autoEnableFlash: _autoEnableFlash,
android: AndroidOptions(
aspectTolerance: _aspectTolerance,
useAutoFocus: _useAutoFocus,
),
);
var result = await BarcodeScanner.scan(options: options);
setState(() => scanResult = result);
} on PlatformException catch (e) {
var result = ScanResult(
type: ResultType.Error,
format: BarcodeFormat.unknown,
);
if (e.code == BarcodeScanner.cameraAccessDenied) {
setState(() {
result.rawContent = 'The user did not grant the camera permission!';
});
} else {
result.rawContent = 'Unknown error: $e';
}
setState(() {
scanResult = result;
});
}
}
}

@ -1,12 +1,18 @@
import 'dart:async';
import 'dart:convert';
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/pages/message_center_page/message_center_page.dart';
import 'package:akuCommunity/pages/scan/scan_page.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/extensions/num_ext.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:akuCommunity/base/assets_image.dart';
import 'package:akuCommunity/utils/screenutil.dart';
import 'widget/home_app_bar.dart';
import 'widget/home_search.dart';
import 'widget/home_swiper.dart';
import 'widget/home_card.dart';
@ -18,6 +24,8 @@ import 'package:akuCommunity/service/base_model.dart';
import 'package:akuCommunity/model/aku_shop_model.dart';
import 'package:akuCommunity/routers/page_routers.dart';
import 'package:velocity_x/velocity_x.dart';
class HomePage extends StatefulWidget {
HomePage({Key key}) : super(key: key);
@ -71,16 +79,67 @@ class _HomePageState extends State<HomePage>
_refreshController.loadComplete();
}
_buildColButton({IconData icon, String title, VoidCallback onTap}) {
return MaterialButton(
onPressed: onTap,
minWidth: 0,
padding: EdgeInsets.symmetric(horizontal: 16.w),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(icon, size: 48.w, color: Colors.black),
4.hb,
title.text.size(20.sp).black.make(),
],
),
);
}
@override
Widget build(BuildContext context) {
super.build(context);
ScreenUtil.init(context,
designSize: Size(750, 1334), allowFontScaling: true);
return Scaffold(
appBar: PreferredSize(
child: HomeAppBar(),
preferredSize: Size.fromHeight(kToolbarHeight),
return BeeScaffold(
title: 'TEST',
bgColor: BaseStyle.colorffd000,
leading: Container(
margin: EdgeInsets.only(left: 32.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'深圳',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 24.sp,
color: Color(0xff333333),
),
),
Text(
'阴 27℃',
style: TextStyle(
fontSize: 20.sp,
color: Color(0xff333333),
),
)
]),
),
actions: [
_buildColButton(
icon: AntDesign.scan1,
title: '扫一扫',
onTap: () => Get.to(ScanPage()),
),
_buildColButton(
icon: AntDesign.bells,
title: '消息',
onTap: () => Get.to(MessageCenterPage()),
),
16.wb,
],
body: RefreshConfiguration(
child: SmartRefresher(
controller: _refreshController,

@ -1,3 +1,4 @@
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:akuCommunity/utils/screenutil.dart';
@ -18,7 +19,6 @@ class _MineCarPageState extends State<MineCarPage> {
{'title': '深圳华茂悦峰', 'subtitle': '1幢-1单元-702室'},
];
Widget _containerHouseCard(String title, subtitle) {
return Container(
margin: EdgeInsets.only(
@ -153,13 +153,8 @@ class _MineCarPageState extends State<MineCarPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PreferredSize(
child: CommonAppBar(
return BeeScaffold(
title: '我的${widget.bundle.getMap('carType')['type']}',
),
preferredSize: Size.fromHeight(kToolbarHeight),
),
body: Container(
color: Colors.white,
child: Stack(

@ -1,3 +1,4 @@
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:akuCommunity/utils/screenutil.dart';
@ -142,13 +143,8 @@ class _MineHousePageState extends State<MineHousePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PreferredSize(
child: CommonAppBar(
return BeeScaffold(
title: '我的房屋',
),
preferredSize: Size.fromHeight(kToolbarHeight),
),
body: Container(
color: Colors.white,
child: ListView(

@ -1,3 +1,4 @@
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:akuCommunity/utils/screenutil.dart';
@ -67,13 +68,8 @@ class _OpenDoorPageState extends State<OpenDoorPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PreferredSize(
child: CommonAppBar(
return BeeScaffold(
title: '一键开门',
),
preferredSize: Size.fromHeight(kToolbarHeight),
),
body: Container(
color: Colors.white,
alignment: Alignment.center,
@ -100,7 +96,7 @@ class _OpenDoorPageState extends State<OpenDoorPage> {
),
Positioned(
top: 120.w,
left:137.5.w,
left: 137.5.w,
child: Image.asset(
'assets/images/lock.png',
width: 125.w,

@ -1,3 +1,4 @@
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:akuCommunity/utils/screenutil.dart';
@ -117,19 +118,8 @@ class _PropertyIndexState extends State<PropertyIndex>
@override
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text(
'物业',
style: TextStyle(
fontSize: 36.sp,
color: Color(0xff333333),
),
),
backgroundColor: Colors.white,
elevation: 0,
),
return BeeScaffold(
title: '物业',
body: SmartRefresher(
controller: _refreshController,
header: WaterDropHeader(),

@ -1,9 +1,7 @@
import 'dart:async';
import 'dart:io' show Platform;
import 'package:barcode_scan/barcode_scan.dart';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart';
class ScanPage extends StatefulWidget {
ScanPage({Key key}) : super(key: key);
@ -13,263 +11,27 @@ class ScanPage extends StatefulWidget {
}
class _ScanPageState extends State<ScanPage> {
ScanResult scanResult;
final _flashOnController = TextEditingController(text: "Flash on");
final _flashOffController = TextEditingController(text: "Flash off");
final _cancelController = TextEditingController(text: "Cancel");
var _aspectTolerance = 0.00;
var _numberOfCameras = 0;
var _selectedCamera = -1;
var _useAutoFocus = true;
var _autoEnableFlash = false;
static final _possibleFormats = BarcodeFormat.values.toList()
..removeWhere((e) => e == BarcodeFormat.unknown);
List<BarcodeFormat> selectedFormats = [..._possibleFormats];
final GlobalKey _qrKey = GlobalKey(debugLabel: 'QR');
QRViewController _controller;
@override
// ignore: type_annotate_public_apis
initState() {
super.initState();
Future.delayed(Duration.zero, () async {
_numberOfCameras = await BarcodeScanner.numberOfCameras;
setState(() {});
});
void reassemble() {
super.reassemble();
if (Platform.isAndroid) {
_controller.pauseCamera();
} else if (Platform.isIOS) {
_controller.resumeCamera();
}
}
@override
Widget build(BuildContext context) {
var contentList = <Widget>[
if (scanResult != null)
Card(
child: Column(
children: <Widget>[
ListTile(
title: Text("Result Type"),
subtitle: Text(scanResult.type?.toString() ?? ""),
),
ListTile(
title: Text("Raw Content"),
subtitle: Text(scanResult.rawContent ?? ""),
),
ListTile(
title: Text("Format"),
subtitle: Text(scanResult.format?.toString() ?? ""),
),
ListTile(
title: Text("Format note"),
subtitle: Text(scanResult.formatNote ?? ""),
),
],
),
),
ListTile(
title: Text("Camera selection"),
dense: true,
enabled: false,
),
RadioListTile(
onChanged: (v) => setState(() => _selectedCamera = -1),
value: -1,
title: Text("Default camera"),
groupValue: _selectedCamera,
),
];
for (var i = 0; i < _numberOfCameras; i++) {
contentList.add(RadioListTile(
onChanged: (v) => setState(() => _selectedCamera = i),
value: i,
title: Text("Camera ${i + 1}"),
groupValue: _selectedCamera,
));
}
contentList.addAll([
ListTile(
title: Text("Button Texts"),
dense: true,
enabled: false,
),
ListTile(
title: TextField(
decoration: InputDecoration(
labelText: "Flash On",
),
controller: _flashOnController,
),
),
ListTile(
title: TextField(
decoration: InputDecoration(
labelText: "Flash Off",
),
controller: _flashOffController,
),
),
ListTile(
title: TextField(
decoration: InputDecoration(
labelText: "Cancel",
),
controller: _cancelController,
),
),
]);
if (Platform.isAndroid) {
contentList.addAll([
ListTile(
title: Text("Android specific options"),
dense: true,
enabled: false,
),
ListTile(
title:
Text("Aspect tolerance (${_aspectTolerance.toStringAsFixed(2)})"),
subtitle: Slider(
min: -1.0,
max: 1.0,
value: _aspectTolerance,
onChanged: (value) {
setState(() {
_aspectTolerance = value;
});
},
),
),
CheckboxListTile(
title: Text("Use autofocus"),
value: _useAutoFocus,
onChanged: (checked) {
setState(() {
_useAutoFocus = checked;
});
},
)
]);
}
contentList.addAll([
ListTile(
title: Text("Other options"),
dense: true,
enabled: false,
),
CheckboxListTile(
title: Text("Start with flash"),
value: _autoEnableFlash,
onChanged: (checked) {
setState(() {
_autoEnableFlash = checked;
});
},
)
]);
contentList.addAll([
ListTile(
title: Text("Barcode formats"),
dense: true,
enabled: false,
),
ListTile(
trailing: Checkbox(
tristate: true,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
value: selectedFormats.length == _possibleFormats.length
? true
: selectedFormats.length == 0
? false
: null,
onChanged: (checked) {
setState(() {
selectedFormats = [
if (checked ?? false) ..._possibleFormats,
];
});
},
),
dense: true,
enabled: false,
title: Text("Detect barcode formats"),
subtitle: Text(
'If all are unselected, all possible platform formats will be used',
),
),
]);
contentList.addAll(_possibleFormats.map(
(format) => CheckboxListTile(
value: selectedFormats.contains(format),
onChanged: (i) {
setState(() => selectedFormats.contains(format)
? selectedFormats.remove(format)
: selectedFormats.add(format));
},
title: Text(format.toString()),
),
));
return Scaffold(
appBar: AppBar(
title: Text('Barcode Scanner Example'),
actions: <Widget>[
IconButton(
icon: Icon(Icons.camera),
tooltip: "Scan",
onPressed: scan,
)
],
),
body: ListView(
scrollDirection: Axis.vertical,
shrinkWrap: true,
children: contentList,
),
);
}
Future scan() async {
try {
var options = ScanOptions(
strings: {
"cancel": _cancelController.text,
"flash_on": _flashOnController.text,
"flash_off": _flashOffController.text,
body: QRView(
key: _qrKey,
onQRViewCreated: (controller) {
_controller = controller;
},
restrictFormat: selectedFormats,
useCamera: _selectedCamera,
autoEnableFlash: _autoEnableFlash,
android: AndroidOptions(
aspectTolerance: _aspectTolerance,
useAutoFocus: _useAutoFocus,
),
);
var result = await BarcodeScanner.scan(options: options);
setState(() => scanResult = result);
} on PlatformException catch (e) {
var result = ScanResult(
type: ResultType.Error,
format: BarcodeFormat.unknown,
);
if (e.code == BarcodeScanner.cameraAccessDenied) {
setState(() {
result.rawContent = 'The user did not grant the camera permission!';
});
} else {
result.rawContent = 'Unknown error: $e';
}
setState(() {
scanResult = result;
});
}
}
}

@ -1,8 +1,5 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:barcode_scan/barcode_scan.dart';
import 'package:akuCommunity/utils/screenutil.dart';
import 'package:akuCommunity/routers/page_routers.dart';
@ -16,71 +13,6 @@ class AppBarAction extends StatefulWidget {
}
class _AppBarActionState extends State<AppBarAction> {
ScanResult scanResult;
final _flashOnController = TextEditingController(text: "打开闪光灯");
final _flashOffController = TextEditingController(text: "关闭闪光灯");
final _cancelController = TextEditingController(text: "关闭");
var _aspectTolerance = 0.00;
var numberOfCameras = 0;
var _selectedCamera = -1;
var _useAutoFocus = true;
var _autoEnableFlash = false;
static final _possibleFormats = BarcodeFormat.values.toList()
..removeWhere((e) => e == BarcodeFormat.unknown);
List<BarcodeFormat> selectedFormats = [..._possibleFormats];
void initState() {
super.initState();
Future.delayed(Duration.zero, () async {
numberOfCameras = await BarcodeScanner.numberOfCameras;
setState(() {});
});
}
Future scan() async {
try {
var options = ScanOptions(
strings: {
"cancel": _cancelController.text,
"flash_on": _flashOnController.text,
"flash_off": _flashOffController.text,
},
restrictFormat: selectedFormats,
useCamera: _selectedCamera,
autoEnableFlash: _autoEnableFlash,
android: AndroidOptions(
aspectTolerance: _aspectTolerance,
useAutoFocus: _useAutoFocus,
),
);
var result = await BarcodeScanner.scan(options: options);
setState(() => scanResult = result);
} on PlatformException catch (e) {
var result = ScanResult(
type: ResultType.Error,
format: BarcodeFormat.unknown,
);
if (e.code == BarcodeScanner.cameraAccessDenied) {
setState(() {
result.rawContent = 'The user did not grant the camera permission!';
});
} else {
result.rawContent = 'Unknown error: $e';
}
setState(() {
scanResult = result;
});
}
}
@override
Widget build(BuildContext context) {
return Container(
@ -106,7 +38,6 @@ class _AppBarActionState extends State<AppBarAction> {
onTap: () {
switch (widget.title) {
case '扫一扫':
scan();
break;
case '消息':
Navigator.pushNamed(

@ -1,10 +1,26 @@
import 'package:akuCommunity/widget/bee_back_button.dart';
import 'package:flutter/material.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class BeeScaffold extends StatefulWidget {
final String title;
final Widget body;
BeeScaffold({Key key, @required this.title, this.body}) : super(key: key);
/// appbar background color
///
/// default Colors.white
final Color bgColor;
final List<Widget> actions;
final Widget leading;
BeeScaffold(
{Key key,
@required this.title,
this.body,
this.actions,
this.leading,
this.bgColor})
: super(key: key);
@override
_BeeScaffoldState createState() => _BeeScaffoldState();
@ -16,11 +32,13 @@ class _BeeScaffoldState extends State<BeeScaffold> {
return Scaffold(
backgroundColor: Color(0xFFF9F9F9),
appBar: AppBar(
backgroundColor: Colors.white,
backgroundColor: widget.bgColor ?? Colors.white,
elevation: 0,
title: Text(widget.title),
title:
widget.title.text.size(32.sp).color(Color(0xFF333333)).bold.make(),
centerTitle: true,
leading: BeeBackButton(),
leading: widget.leading ?? BeeBackButton(),
actions: widget.actions,
),
body: widget.body,
);

@ -1,3 +1,4 @@
import 'package:akuCommunity/pages/open_door_page/open_door_page.dart';
import 'package:akuCommunity/pages/setting_page/settings_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@ -22,8 +23,7 @@ class GridButton extends StatelessWidget {
onTap: () {
switch (gridList[index]['title']) {
case '一键开门':
Navigator.pushNamed(
context, PageName.open_door_page.toString());
Get.to(OpenDoorPage());
break;
case '开门码':
Navigator.pushNamed(

@ -99,13 +99,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
barcode_scan:
dependency: "direct main"
description:
name: barcode_scan
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.1"
boolean_selector:
dependency: transitive
description:
@ -316,13 +309,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.2.1"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.10.11"
flare_dart:
dependency: transitive
description:
@ -833,13 +819,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.5"
protobuf:
dependency: transitive
description:
name: protobuf
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
provider:
dependency: "direct main"
description:
@ -868,6 +847,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
qr_code_scanner:
dependency: "direct main"
description:
name: qr_code_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.0"
qr_flutter:
dependency: "direct main"
description:

@ -77,8 +77,8 @@ dependencies:
animate_do: ^1.7.3
#动画alert
rflutter_alert: ^1.1.0
#扫码
barcode_scan: ^3.0.1
qr_code_scanner: ^0.3.0
#时间选择
flutter_datetime_picker: ^1.4.0
#随机二维码

@ -0,0 +1,30 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:akuCommunity/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
Loading…
Cancel
Save