# Conflicts:
#	example/lib/main.dart
null_safety
张萌 4 years ago
commit a6688ca4f9

@ -2,10 +2,20 @@
## dep
![flutter_screenutil](https://img.shields.io/badge/flutter__screenutil-%203.2.0-brightgreen)
![flutter_screenutil](https://img.shields.io/badge/flutter__screenutil-3.2.0-brightgreen)
## Getting Started
### 安装ansu_ui
#### Android
Change the minimum Android sdk version to 21 (or higher) in your `android/app/build.gradle` file.
```gradle
minSdkVersion 21
```
## 贡献
### 组件命名

@ -39,7 +39,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
minSdkVersion 16
minSdkVersion 21
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

@ -10,7 +10,6 @@ class ExampleButton extends StatefulWidget {
}
class _ExampleButtonState extends State<ExampleButton> {
TextEditingController _EditingController = TextEditingController();
@override
Widget build(BuildContext context) {
return ASScaffold(
@ -70,11 +69,6 @@ class _ExampleButtonState extends State<ExampleButton> {
padding: EdgeInsets.symmetric(horizontal: 100.w),
child: ASLongButton.solid(title: 'null', onPressed: () {}),
),
ASNumericButton(
initValue: 1,
suffix: '',
onChange: (value) {},
),
Row(
children: [
ASButton.order(

@ -0,0 +1,43 @@
import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter/material.dart';
class ExampleNumericButton extends StatefulWidget {
ExampleNumericButton({Key key}) : super(key: key);
@override
_ExampleNumericButtonState createState() => _ExampleNumericButtonState();
}
class _ExampleNumericButtonState extends State<ExampleNumericButton> {
_showSnack(BuildContext context, String title) {
Scaffold.of(context).showSnackBar(
SnackBar(content: Text(title)),
);
}
@override
Widget build(BuildContext context) {
return ASScaffold(
title: '数量选择器',
body: Builder(
builder: (context) {
return ListView(
children: [
ASNumericButton(
initValue: 0,
maxValue: 10,
onChange: (value) {},
reachMax: (value) {
_showSnack(context, 'reach max');
},
reachMin: (value) {
_showSnack(context, 'reach min');
},
)
],
);
},
),
);
}
}

@ -26,7 +26,7 @@ class _ExampleScaffoldState extends State<ExampleScaffold>
@override
Widget build(BuildContext context) {
return ASScaffold(
title: '标题 SCaffold',
title: '标题 Scaffold',
appBarBottom: ASTabBar(
items: tabs,
isScrollable: true,

@ -0,0 +1,58 @@
import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter/material.dart';
class ExampleTabBar extends StatefulWidget {
ExampleTabBar({Key key}) : super(key: key);
@override
_ExampleTabBarState createState() => _ExampleTabBarState();
}
class _ExampleTabBarState extends State<ExampleTabBar>
with TickerProviderStateMixin {
TabController _tabController1;
TabController _tabController2;
TabController _tabController3;
@override
void initState() {
super.initState();
_tabController1 = TabController(length: 3, vsync: this);
_tabController2 = TabController(length: 5, vsync: this);
_tabController3 = TabController(length: 10, vsync: this);
}
@override
void dispose() {
_tabController1?.dispose();
_tabController2?.dispose();
_tabController3?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return ASScaffold(
title: 'TabBar',
appBarBottom: PreferredSize(
child: Column(
children: [
ASTabBar(
items: ['全部', 'Part1', 'Part2'],
controller: _tabController1,
),
ASTabBar(
items: List.generate(5, (index) => 'Tab $index'),
controller: _tabController2,
),
ASTabBar(
isScrollable: true,
items: List.generate(10, (index) => 'Tab $index'),
controller: _tabController3,
),
],
),
preferredSize: Size.fromHeight(46 * 3.0),
),
);
}
}

@ -3,8 +3,12 @@ import 'package:example/example_bottom_button.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'example_numeric_button.dart';
import 'example_scaffold.dart';
import 'example_button.dart';
import 'example_tab_bar.dart';
import 'example_numeric_button.dart';
import 'example_tab_bar.dart';
void main() {
runApp(MyApp());
@ -42,10 +46,21 @@ class _MyHomePageState extends State<MyHomePage> {
return ASScaffold(
title: '安速组件',
body: ListView(
padding: EdgeInsets.all(16.w),
children: [
ASButton.info(title:'Button',onPressed: () => Get.to(ExampleButton())),
ASButton.info(title:'Scaffold', onPressed:() => Get.to(ExampleScaffold())),
ASButton.info(title: 'BottomBottun',onPressed: () => Get.to(ExampleBottomButton()),),
ASButton.info(
title: '按钮 Button', onPressed: () => Get.to(ExampleButton())),
ASButton.info(
title: 'Scaffold', onPressed: () => Get.to(ExampleScaffold())),
ASButton.info(
title: 'Tabbar', onPressed: () => Get.to(ExampleTabBar())),
ASButton.info(
title: '数量选择器NumericButton',
onPressed: () => Get.to(ExampleNumericButton())),
ASButton.info(
title: '底部按钮 BottomButton',
onPressed: () => Get.to(ExampleBottomButton()),
)
],
),
);

@ -8,6 +8,7 @@ export 'scaffold/as_scaffold.dart';
export 'styles/as_colors.dart';
export 'bar/as_tabbar.dart';
export 'drawer/as_drawer.dart';
export 'utils/screen_adapter.dart';
//`BOTTOM` is external lib

@ -95,6 +95,12 @@ class _ASNumericButtonState extends State<ASNumericButton> {
_controller = TextEditingController(text: widget.initValue.toString());
}
@override
void dispose() {
_controller?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Row(
@ -125,9 +131,11 @@ class _ASNumericButtonState extends State<ASNumericButton> {
alignment: Alignment.center,
child: IntrinsicWidth(
child: TextField(
keyboardType: TextInputType.number,
controller: _controller,
onChanged: (text) {
setState(() {});
//TODO input check
},
focusNode: _focusNode,
style: TextStyle(

Loading…
Cancel
Save