add qrcode scan

add aku scaffold
add aku backbutton
add settings page
hmxc
小赖 4 years ago
parent 0ce81f09f6
commit 166d957f9d

@ -39,7 +39,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.akucommunity.aku_community_manager"
minSdkVersion 16
minSdkVersion 24
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

@ -1 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"

@ -1 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"

@ -0,0 +1,41 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end

@ -1,5 +1,6 @@
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/ui/home/home_page.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
@ -13,13 +14,16 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MultiProvider(
providers:[
ChangeNotifierProvider(create: (context)=>UserProvider()),
providers: [
ChangeNotifierProvider(create: (context) => UserProvider()),
],
child: GetMaterialApp(
child: GetMaterialApp(
title: '小蜜蜂管家',
home: HomePage(),
builder: BotToastInit(),
navigatorObservers: [
BotToastNavigatorObserver(),
],
),
);
}

@ -5,7 +5,9 @@ class AppStyle {
static const minorColor=Color(0xFFFFDF5D);
//
///
static const primaryTextColor=Color(0xFF333333);
///
static const minorTextColor=Color(0xFF999999);
}

@ -1,3 +1,4 @@
import 'package:flutter_screenutil/flutter_screenutil.dart';
export 'package:flutter_screenutil/flutter_screenutil.dart';
double get statusBarHeight => ScreenUtil().statusBarHeight;

@ -3,6 +3,7 @@ import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/home/personal_draw.dart';
import 'package:aku_community_manager/ui/tool_pages/scan_page.dart';
import 'package:aku_ui/aku_ui.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:flutter/material.dart';
@ -80,7 +81,7 @@ Widget _card(String number, String text, Color color) {
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
final userProvider=Provider.of<UserProvider>(context);
final userProvider = Provider.of<UserProvider>(context);
ScreenUtil.init(context,
designSize: Size(750, 1334), allowFontScaling: true);
return Scaffold(
@ -124,9 +125,11 @@ class _HomePageState extends State<HomePage> {
onPressed: () {
Scaffold.of(context).openDrawer();
},
child: CircleAvatar(radius: 36.w,
backgroundColor: Colors.grey,
child: userProvider.isSigned?null:null,),
child: CircleAvatar(
radius: 36.w,
backgroundColor: Colors.grey,
child: userProvider.isSigned ? null : null,
),
);
})),
SizedBox(width: 16.w),
@ -173,7 +176,9 @@ class _HomePageState extends State<HomePage> {
height: double.infinity,
minWidth: 78.w,
padding: EdgeInsets.zero,
onPressed: () {},
onPressed: () {
Get.to(ScanPage());
},
child: Column(children: [
Icon(
Icons.access_alarm,

@ -1,9 +1,11 @@
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/settings/settings_page.dart';
import 'package:aku_ui/common_widgets/aku_button.dart';
import 'package:aku_ui/common_widgets/aku_round_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
class PersonalDraw extends StatefulWidget {
@ -14,9 +16,9 @@ class PersonalDraw extends StatefulWidget {
}
class _PersonalDrawState extends State<PersonalDraw> {
Widget _myListTile(IconData iconData, String text) {
Widget _myListTile(IconData iconData, String text, {VoidCallback onPressed}) {
return AkuButton(
onPressed: () {},
onPressed: onPressed,
child: Container(
width: double.infinity,
height: 96.w,
@ -108,7 +110,9 @@ class _PersonalDrawState extends State<PersonalDraw> {
),
_myListTile(Icons.contact_page, '个人信息'),
_myListTile(Icons.supervised_user_circle, '联系客服'),
_myListTile(Icons.settings, '设置'),
_myListTile(Icons.settings, '设置', onPressed: () {
Get.to(SettingsPage());
}),
],
),
);

@ -0,0 +1,19 @@
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:flutter/material.dart';
class SettingsPage extends StatefulWidget {
SettingsPage({Key key}) : super(key: key);
@override
_SettingsPageState createState() => _SettingsPageState();
}
class _SettingsPageState extends State<SettingsPage> {
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '设置',
body: Text('test'),
);
}
}

@ -0,0 +1,52 @@
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart';
class ScanPage extends StatefulWidget {
ScanPage({Key key}) : super(key: key);
@override
_ScanPageState createState() => _ScanPageState();
}
class _ScanPageState extends State<ScanPage> {
GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
QRViewController _qrViewController;
@override
void dispose() {
_qrViewController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
QRView(
key: qrKey,
onQRViewCreated: (controller) {
_qrViewController = controller;
controller.scannedDataStream.listen((event) {
BotToast.showText(text: event);
});
},
),
Center(
child: Container(
height: 200,
width: 200,
decoration: BoxDecoration(
border: Border.all(
color: Colors.red,
width: 1,
),
),
),
),
],
),
);
}
}

@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
class AkuBackButton extends StatefulWidget {
final Brightness brightness;
AkuBackButton({
Key key,
this.brightness = Brightness.light,
}) : super(key: key);
@override
_AkuBackButtonState createState() => _AkuBackButtonState();
}
class _AkuBackButtonState extends State<AkuBackButton> {
@override
Widget build(BuildContext context) {
return Navigator.canPop(context)
? IconButton(
icon: Icon(
Icons.arrow_back_ios,
size: 32.w,
color: widget.brightness == Brightness.light
? Color(0xFF333333)
: Color(0xFFEEEEEE),
),
onPressed: () {
Navigator.pop(context);
},
)
: SizedBox();
}
}

@ -0,0 +1,81 @@
import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart';
import 'package:flutter/material.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
///Scaffold
class AkuScaffold extends StatefulWidget {
///AppBar 使 `title`,`titleStyle`,`leading`,`brightness`
final PreferredSizeWidget appBar;
///title
final String title;
///title style
///
///
///
///```
///TextStyle(
/// fontWeight: FontWeight.bold,
/// color: Color(0xFF333333),
/// fontSize: 36.sp,
///)
///```
final TextStyle titleStyle;
///leading
///
///使 `AkuBackButton`
final Widget leading;
///brightness
final Brightness brightness;
///body
final Widget body;
///
///
///`0xFFF9F9F9`
final Color backgroundColor;
AkuScaffold({
Key key,
this.appBar,
this.title,
this.titleStyle,
this.leading,
this.brightness = Brightness.light,
this.body,
this.backgroundColor = const Color(0XFFF9F9F9),
}) : super(key: key);
@override
_AkuScaffoldState createState() => _AkuScaffoldState();
}
class _AkuScaffoldState extends State<AkuScaffold> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: widget.backgroundColor,
appBar: AppBar(
backgroundColor: Colors.white,
leading: widget.leading ?? AkuBackButton(),
brightness: widget.brightness,
elevation: 0,
centerTitle: true,
title: DefaultTextStyle(
style: widget.titleStyle ??
TextStyle(
fontWeight: FontWeight.bold,
color: Color(0xFF333333),
fontSize: 36.sp,
),
child: Text(widget.title),
),
),
body: widget.body,
);
}
}

@ -24,6 +24,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0-nullsafety.1"
bot_toast:
dependency: "direct main"
description:
name: bot_toast
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.4"
characters:
dependency: transitive
description:
@ -132,6 +139,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.3.2+2"
qr_code_scanner:
dependency: "direct main"
description:
name: qr_code_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.13"
sky_engine:
dependency: transitive
description: flutter

@ -3,7 +3,7 @@ description: A new Flutter application.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
publish_to: "none" # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
@ -24,7 +24,6 @@ dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
@ -36,6 +35,10 @@ dependencies:
get: ^3.15.0
#刷新
flutter_easyrefresh: ^2.1.6
#qrcode san
qr_code_scanner: ^0.0.13
#toast
bot_toast: ^3.0.4
aku_ui:
git:
@ -50,23 +53,18 @@ dev_dependencies:
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a

Loading…
Cancel
Save