# Conflicts:
#	example/lib/example_button.dart
null_safety
张萌 4 years ago
commit e2f54c269e

@ -1,8 +1,9 @@
# ansu_ui 安速物流移动组件 # ansu_ui 安速物流移动组件
## dep ## dep 依赖
![flutter_screenutil](https://img.shields.io/badge/flutter__screenutil-3.2.0-brightgreen) ![flutter_screenutil](https://img.shields.io/badge/flutter__screenutil-3.2.0-brightgreen)
![get](https://img.shields.io/badge/get-3.17.1-brightgreen)
## Getting Started ## Getting Started

@ -18,9 +18,9 @@ class _ExampleButtonState extends State<ExampleButton> {
children: [ children: [
Row( Row(
children: [ children: [
Text('delete'), Text('danger'),
Spacer(), Spacer(),
ASButton.delete( ASButton.danger(
title: '删除订单', title: '删除订单',
onPressed: () {}, onPressed: () {},
), ),
@ -48,9 +48,9 @@ class _ExampleButtonState extends State<ExampleButton> {
), ),
Row( Row(
children: [ children: [
Text('opration'), Text('operation'),
Spacer(), Spacer(),
ASButton.opration( ASButton.operation(
title: '删除订单', title: '删除订单',
onPressed: () {}, onPressed: () {},
), ),

@ -0,0 +1,39 @@
import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter/material.dart';
class ExampleDrawer extends StatefulWidget {
ExampleDrawer({Key key}) : super(key: key);
@override
_ExampleDrawerState createState() => _ExampleDrawerState();
}
class _ExampleDrawerState extends State<ExampleDrawer> {
@override
Widget build(BuildContext context) {
return ASScaffold(
title: 'Drawer',
endDrawer: ASDrawer(
children: [
Text('title'),
],
bottom: ASLongButton.solid(
title: '确定',
onPressed: () {},
),
),
body: Center(
child: Builder(
builder: (context) {
return ASLongButton.solid(
title: 'DRAWER',
onPressed: () {
Scaffold.of(context).openEndDrawer();
},
);
},
),
),
);
}
}

@ -26,14 +26,16 @@ class _ExampleScaffoldState extends State<ExampleScaffold>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ASScaffold( return ASScaffold(
title: '标题 Scaffold', title: '框架 Scaffold',
appBarBottom: ASTabBar( appBarBottom: ASTabBar(
items: tabs, items: tabs,
isScrollable: true, isScrollable: true,
controller: _tabController, controller: _tabController,
), ),
endDrawer: ASDrawer( endDrawer: ASDrawer(
child: Text('DRAWER'), children: [
Text('DRAWER'),
],
), ),
body: ListView( body: ListView(
children: [ children: [

@ -15,6 +15,14 @@ class _ExampleStyleColorState extends State<ExampleStyleColor> {
children: [ children: [
Text(object.name), Text(object.name),
Text(object.codeName), Text(object.codeName),
Text(
object.color.toString(),
style: TextStyle(
color: object.color,
backgroundColor:
object.color.value > 0xFFAAAAAA ? Colors.black : Colors.white,
),
),
Card( Card(
color: object.color, color: object.color,
child: SizedBox(height: 50.w, width: double.infinity), child: SizedBox(height: 50.w, width: double.infinity),

@ -32,7 +32,7 @@ class _ExampleTabBarState extends State<ExampleTabBar>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ASScaffold( return ASScaffold(
title: 'TabBar', title: '选项卡 TabBar',
appBarBottom: PreferredSize( appBarBottom: PreferredSize(
child: Column( child: Column(
children: [ children: [

@ -1,5 +1,6 @@
import 'package:ansu_ui/ansu_ui.dart'; import 'package:ansu_ui/ansu_ui.dart';
import 'package:example/example_bottom_button.dart'; import 'package:example/example_bottom_button.dart';
import 'package:example/example_drawer.dart';
import 'package:example/example_tag.dart'; import 'package:example/example_tag.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
@ -54,6 +55,12 @@ class _MyHomePageState extends State<MyHomePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ASScaffold( return ASScaffold(
leading: navigator.canPop()
? IconButton(
icon: Icon(Icons.backpack, color: Colors.black),
onPressed: () {},
)
: SizedBox(),
title: '安速组件', title: '安速组件',
body: ListView( body: ListView(
padding: EdgeInsets.all(16.w), padding: EdgeInsets.all(16.w),
@ -66,9 +73,9 @@ class _MyHomePageState extends State<MyHomePage> {
ASButton.info( ASButton.info(
title: '按钮 Button', onPressed: () => Get.to(ExampleButton())), title: '按钮 Button', onPressed: () => Get.to(ExampleButton())),
ASButton.info( ASButton.info(
title: 'Scaffold', onPressed: () => Get.to(ExampleScaffold())), title: '框架 Scaffold', onPressed: () => Get.to(ExampleScaffold())),
ASButton.info( ASButton.info(
title: 'Tabbar', onPressed: () => Get.to(ExampleTabBar())), title: '选项卡 Tabbar', onPressed: () => Get.to(ExampleTabBar())),
ASButton.info( ASButton.info(
title: '数量选择器NumericButton', title: '数量选择器NumericButton',
onPressed: () => Get.to(ExampleNumericButton())), onPressed: () => Get.to(ExampleNumericButton())),
@ -78,7 +85,14 @@ class _MyHomePageState extends State<MyHomePage> {
title: '底部按钮 BottomButton', title: '底部按钮 BottomButton',
onPressed: () => Get.to(ExampleBottomButton()), onPressed: () => Get.to(ExampleBottomButton()),
), ),
ASButton.info(title: '标签 TAG',onPressed: () => Get.to(ExampleTag()),), ASButton.info(
title: '标签 TAG',
onPressed: () => Get.to(ExampleTag()),
),
ASButton.info(
title: '抽屉 DRAWER',
onPressed: () => Get.to(ExampleDrawer()),
),
], ],
), ),
); );

@ -1,6 +1,7 @@
import 'package:ansu_ui/ansu_ui.dart'; import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
/// ///
/// ///
@ -17,7 +18,7 @@ class ASBackButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Navigator.canPop(context) return navigator.canPop()
? IconButton( ? IconButton(
icon: Icon( icon: Icon(
CupertinoIcons.chevron_back, CupertinoIcons.chevron_back,

@ -1,3 +1,4 @@
import 'package:ansu_ui/styles/as_colors.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -40,6 +41,8 @@ class ASButton extends StatefulWidget {
/// ///
final Color disableTextColor; final Color disableTextColor;
final Color splashColor;
ASButton({ ASButton({
Key key, Key key,
this.bgcolor, this.bgcolor,
@ -54,22 +57,24 @@ class ASButton extends StatefulWidget {
this.width, this.width,
this.disableColor, this.disableColor,
this.disableTextColor, this.disableTextColor,
this.splashColor,
}) : super(key: key); }) : super(key: key);
ASButton.warn( ASButton.danger({
{Key key, Key key,
this.textStyle, this.textStyle,
this.padding, this.padding,
this.radius, this.radius,
this.bgcolor, this.bgcolor,
this.onPressed, this.onPressed,
@required this.title, @required this.title,
this.width, this.width,
this.disableColor, this.disableColor,
this.disableTextColor}) this.disableTextColor,
: outline = true, }) : outline = true,
outlineColor = Color(0xFFE50112), outlineColor = kDangerColor,
textColor = Color(0xFFE50112), textColor = kDangerColor,
splashColor = kDangerColor.withOpacity(0.2),
super(key: key); super(key: key);
ASButton.info( ASButton.info(
@ -82,13 +87,14 @@ class ASButton extends StatefulWidget {
this.onPressed, this.onPressed,
this.width, this.width,
this.disableColor, this.disableColor,
this.disableTextColor}) this.disableTextColor,
this.splashColor})
: outline = true, : outline = true,
outlineColor = Color(0x73000000), outlineColor = Color(0x73000000),
textColor = Color(0xD9000000), textColor = Color(0xD9000000),
super(key: key); super(key: key);
ASButton.delete( ASButton.warn(
{Key key, {Key key,
this.radius, this.radius,
this.outlineColor, this.outlineColor,
@ -98,12 +104,13 @@ class ASButton extends StatefulWidget {
this.onPressed, this.onPressed,
this.width, this.width,
this.disableColor, this.disableColor,
this.disableTextColor}) this.disableTextColor,
this.splashColor})
: bgcolor = Color(0xFFFFB600), : bgcolor = Color(0xFFFFB600),
textColor = Color(0xD9FFFFFF), textColor = Color(0xD9FFFFFF),
outline = false, outline = false,
super(key: key); super(key: key);
ASButton.opration( ASButton.operation(
{Key key, {Key key,
this.radius, this.radius,
this.outlineColor, this.outlineColor,
@ -113,7 +120,8 @@ class ASButton extends StatefulWidget {
this.onPressed, this.onPressed,
this.width, this.width,
this.disableColor, this.disableColor,
this.disableTextColor}) this.disableTextColor,
this.splashColor})
: bgcolor = Color(0xFFF2F2F2), : bgcolor = Color(0xFFF2F2F2),
textColor = Color(0xD9000000), textColor = Color(0xD9000000),
outline = false, outline = false,
@ -124,6 +132,7 @@ class ASButton extends StatefulWidget {
this.onPressed, this.onPressed,
this.outlineColor, this.outlineColor,
this.width, this.width,
this.splashColor,
}) : bgcolor = Color(0xFFFFBD32), }) : bgcolor = Color(0xFFFFBD32),
textColor = Color(0xFF0000000), textColor = Color(0xFF0000000),
textStyle = TextStyle(fontSize: 14.sp, fontWeight: FontWeight.bold), textStyle = TextStyle(fontSize: 14.sp, fontWeight: FontWeight.bold),
@ -158,7 +167,9 @@ class _ASButtonState extends State<ASButton> {
? BorderSide(color: widget.outlineColor, width: 0.5.w) ? BorderSide(color: widget.outlineColor, width: 0.5.w)
: BorderSide.none, : BorderSide.none,
borderRadius: BorderRadius.circular(widget.radius ?? 15.5.w)), borderRadius: BorderRadius.circular(widget.radius ?? 15.5.w)),
color: widget.bgcolor ?? Color(0xFFFFFFFF), color: widget.bgcolor ?? kForegroundColor,
splashColor: widget.splashColor,
highlightColor: widget.splashColor,
elevation: 0, elevation: 0,
focusElevation: 0, focusElevation: 0,
highlightElevation: 0, highlightElevation: 0,

@ -4,9 +4,54 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
/// ///
class ASDrawer extends StatefulWidget { class ASDrawer extends StatefulWidget {
///List Children
///
///ListView
final List<Widget> children;
///Padding
///
///Padding `EdgeInsets.fromLTRB(26.w, 24.w, 26.w, 90.w)`
final EdgeInsets padding;
///
///
///
///```dart
///bottom: 45.w,
///left: 26.w,
///right: 26.w,
///```
final Widget bottom;
/// ///
///
///使`bottom``padding``children`
final Widget child; final Widget child;
ASDrawer({Key key, @required this.child}) : super(key: key);
///
///
///Padding `EdgeInsets.fromLTRB(26.w, 24.w, 26.w, 90.w)`
ASDrawer({
Key key,
this.children,
this.bottom,
this.child,
}) : this.padding = EdgeInsets.fromLTRB(26.w, 24.w, 26.w, 90.w),
assert(child != null || children != null,
'child or children cant be null'),
super(key: key);
///Padding
ASDrawer.padding({
Key key,
this.padding = EdgeInsets.zero,
this.children,
this.child,
this.bottom,
}) : assert(child != null || children != null,
'child or children cant be null'),
super(key: key);
@override @override
_ASDrawerState createState() => _ASDrawerState(); _ASDrawerState createState() => _ASDrawerState();
@ -17,16 +62,28 @@ class _ASDrawerState extends State<ASDrawer> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Align( return Align(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
child: SizedBox( child: ClipRRect(
height: screenHeight - statusBarHeight, borderRadius: BorderRadius.only(topLeft: Radius.circular(34.w)),
width: screenWidth - 44.w, child: SizedBox(
child: Material( height: screenHeight - statusBarHeight,
shape: RoundedRectangleBorder( width: screenWidth - 44.w,
borderRadius: BorderRadius.only( child: Material(
topLeft: Radius.circular(34.w), child: widget.child ??
), Stack(
children: [
ListView(
padding: widget.padding,
children: widget.children,
),
Positioned(
child: widget.bottom ?? SizedBox(),
bottom: 45.w,
left: 26.w,
right: 26.w,
),
],
),
), ),
child: widget.child,
), ),
), ),
); );

@ -54,7 +54,7 @@ class _ASScaffoldState extends State<ASScaffold> {
appBar: AppBar( appBar: AppBar(
backgroundColor: kForegroundColor, backgroundColor: kForegroundColor,
elevation: 0, elevation: 0,
leading: ASBackButton(), leading: widget.leading ?? ASBackButton(),
centerTitle: true, centerTitle: true,
title: DefaultTextStyle( title: DefaultTextStyle(
style: TextStyle( style: TextStyle(

@ -17,3 +17,6 @@ const Color kForegroundColor = Color(0xFFFFFFFF);
/// ///
const Color kBackgroundColor = Color(0xFFF6F6F6); const Color kBackgroundColor = Color(0xFFF6F6F6);
///
const Color kDangerColor = Color(0xFFE50112);

@ -67,6 +67,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
get:
dependency: "direct main"
description:
name: get
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.17.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -150,5 +157,5 @@ packages:
source: hosted source: hosted
version: "2.1.0-nullsafety.3" version: "2.1.0-nullsafety.3"
sdks: sdks:
dart: ">=2.10.0-110 <2.11.0" dart: ">=2.10.0 <2.11.0"
flutter: ">=1.17.0" flutter: ">=1.17.0"

@ -11,6 +11,7 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_screenutil: ^3.2.0 flutter_screenutil: ^3.2.0
get: ^3.17.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save