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

@ -1,8 +1,9 @@
# ansu_ui 安速物流移动组件
## dep
## dep 依赖
![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

@ -18,9 +18,9 @@ class _ExampleButtonState extends State<ExampleButton> {
children: [
Row(
children: [
Text('delete'),
Text('danger'),
Spacer(),
ASButton.delete(
ASButton.danger(
title: '删除订单',
onPressed: () {},
),
@ -48,9 +48,9 @@ class _ExampleButtonState extends State<ExampleButton> {
),
Row(
children: [
Text('opration'),
Text('operation'),
Spacer(),
ASButton.opration(
ASButton.operation(
title: '删除订单',
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
Widget build(BuildContext context) {
return ASScaffold(
title: '标题 Scaffold',
title: '框架 Scaffold',
appBarBottom: ASTabBar(
items: tabs,
isScrollable: true,
controller: _tabController,
),
endDrawer: ASDrawer(
child: Text('DRAWER'),
children: [
Text('DRAWER'),
],
),
body: ListView(
children: [

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

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

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

@ -1,3 +1,4 @@
import 'package:ansu_ui/styles/as_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -40,6 +41,8 @@ class ASButton extends StatefulWidget {
///
final Color disableTextColor;
final Color splashColor;
ASButton({
Key key,
this.bgcolor,
@ -54,22 +57,24 @@ class ASButton extends StatefulWidget {
this.width,
this.disableColor,
this.disableTextColor,
this.splashColor,
}) : super(key: key);
ASButton.warn(
{Key key,
this.textStyle,
this.padding,
this.radius,
this.bgcolor,
this.onPressed,
@required this.title,
this.width,
this.disableColor,
this.disableTextColor})
: outline = true,
outlineColor = Color(0xFFE50112),
textColor = Color(0xFFE50112),
ASButton.danger({
Key key,
this.textStyle,
this.padding,
this.radius,
this.bgcolor,
this.onPressed,
@required this.title,
this.width,
this.disableColor,
this.disableTextColor,
}) : outline = true,
outlineColor = kDangerColor,
textColor = kDangerColor,
splashColor = kDangerColor.withOpacity(0.2),
super(key: key);
ASButton.info(
@ -82,13 +87,14 @@ class ASButton extends StatefulWidget {
this.onPressed,
this.width,
this.disableColor,
this.disableTextColor})
this.disableTextColor,
this.splashColor})
: outline = true,
outlineColor = Color(0x73000000),
textColor = Color(0xD9000000),
super(key: key);
ASButton.delete(
ASButton.warn(
{Key key,
this.radius,
this.outlineColor,
@ -98,12 +104,13 @@ class ASButton extends StatefulWidget {
this.onPressed,
this.width,
this.disableColor,
this.disableTextColor})
this.disableTextColor,
this.splashColor})
: bgcolor = Color(0xFFFFB600),
textColor = Color(0xD9FFFFFF),
outline = false,
super(key: key);
ASButton.opration(
ASButton.operation(
{Key key,
this.radius,
this.outlineColor,
@ -113,7 +120,8 @@ class ASButton extends StatefulWidget {
this.onPressed,
this.width,
this.disableColor,
this.disableTextColor})
this.disableTextColor,
this.splashColor})
: bgcolor = Color(0xFFF2F2F2),
textColor = Color(0xD9000000),
outline = false,
@ -124,6 +132,7 @@ class ASButton extends StatefulWidget {
this.onPressed,
this.outlineColor,
this.width,
this.splashColor,
}) : bgcolor = Color(0xFFFFBD32),
textColor = Color(0xFF0000000),
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.none,
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,
focusElevation: 0,
highlightElevation: 0,

@ -4,9 +4,54 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
///
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;
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
_ASDrawerState createState() => _ASDrawerState();
@ -17,16 +62,28 @@ class _ASDrawerState extends State<ASDrawer> {
Widget build(BuildContext context) {
return Align(
alignment: Alignment.bottomRight,
child: SizedBox(
height: screenHeight - statusBarHeight,
width: screenWidth - 44.w,
child: Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(34.w),
),
child: ClipRRect(
borderRadius: BorderRadius.only(topLeft: Radius.circular(34.w)),
child: SizedBox(
height: screenHeight - statusBarHeight,
width: screenWidth - 44.w,
child: Material(
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,
),
),
);

@ -27,7 +27,7 @@ class ASScaffold extends StatefulWidget {
final PreferredSizeWidget appBarBottom;
/// `EndDrawer` endDrawer
///
///
///
final Widget endDrawer;
ASScaffold({
@ -54,7 +54,7 @@ class _ASScaffoldState extends State<ASScaffold> {
appBar: AppBar(
backgroundColor: kForegroundColor,
elevation: 0,
leading: ASBackButton(),
leading: widget.leading ?? ASBackButton(),
centerTitle: true,
title: DefaultTextStyle(
style: TextStyle(

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

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

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

Loading…
Cancel
Save