Merge branch 'master' of 192.168.2.201:laiiihz/ansu_ui

* 'master' of 192.168.2.201:laiiihz/ansu_ui:
  修改按钮,add bottom button

# Conflicts:
#	example/lib/main.dart
null_safety
小赖 4 years ago
commit 1830f487d4

@ -0,0 +1,49 @@
import 'package:ansu_ui/ansu_ui.dart';
import 'package:ansu_ui/buttons/as_bottom_button.dart';
import 'package:flutter/material.dart';
class ExampleBottomButton extends StatefulWidget {
ExampleBottomButton({Key key}) : super(key: key);
@override
_ExampleBottomButtonState createState() => _ExampleBottomButtonState();
}
class _ExampleBottomButtonState extends State<ExampleBottomButton> {
@override
Widget build(BuildContext context) {
return ASScaffold(
title: 'BottomButton',
body: Center(),
bottomNavigationBar: Column(
mainAxisSize: MainAxisSize.min,
children: [
ASBottomButton.infinity(
title: 'null',
onPressed: () {},
),
ASBottomButton.gradient(
title: '新增地址',
onPressed: () {},
),
Row(
children: [
SizedBox(
width: 112.w,
child: ASBottomButton.shortWhite(
title: 'null',
onPressed: () {},
),
),
Expanded(
child: ASBottomButton.gradient(
title: 'null',
onPressed: () {},
))
],
)
],
),
);
}
}

@ -1,4 +1,5 @@
import 'package:ansu_ui/ansu_ui.dart';
import 'package:example/example_bottom_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart';
@ -68,6 +69,10 @@ class _MyHomePageState extends State<MyHomePage> {
onPressed: () => Get.to(ExampleNumericButton())),
ASButton.info(
title: '选择器 Pickers', onPressed: () => Get.to(ExamplePicker())),
ASButton.info(
title: '底部按钮 BottomButton',
onPressed: () => Get.to(ExampleBottomButton()),
)
],
),
);

@ -0,0 +1,142 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ASBottomButton extends StatefulWidget {
///
final dynamic title;
///
final Color bgcolor;
///
final Color textColor;
///
final TextStyle textStyle;
///
final EdgeInsetsGeometry padding;
///
final Color disableColor;
///
final Color disableTextColor;
///
final double width;
///
final AlignmentGeometry begin;
///
final AlignmentGeometry end;
///
final List<Color> colors;
///
final VoidCallback onPressed;
ASBottomButton(
{Key key,
this.title,
this.bgcolor,
this.textColor,
this.textStyle,
this.padding,
this.disableColor,
this.disableTextColor,
this.width,
this.begin,
this.end,
this.colors,
this.onPressed})
: super(key: key);
ASBottomButton.infinity({
Key key,
@required this.title,
this.onPressed,
this.textStyle,
this.padding,
this.disableColor,
this.disableTextColor,
this.begin,
this.end,
this.colors,
}) : bgcolor = Color(0xFFF6B72D),
textColor = Color(0xFFFFFFFF),
width = double.infinity,
super(key: key);
ASBottomButton.gradient(
{Key key,
@required this.title,
this.onPressed,
this.bgcolor,
this.textStyle,
this.padding,
this.disableColor,
this.disableTextColor,
this.begin,
this.end})
: colors = [Color(0xFFFFA700), Color(0xFFFFBD00)],
textColor = Color(0xFFFFFFFF),
width = double.infinity,
super(key: key);
ASBottomButton.shortWhite({
Key key,
@required this.title,
this.onPressed,
this.bgcolor,
this.textStyle,
this.padding,
this.disableColor,
this.disableTextColor,
this.begin,
this.end,
}) : colors = [Color(0xFFFBFBFB), Color(0xFFFFFFFF)],
textColor = Color(0xFFFFB800),
width = double.infinity,
super(key: key);
@override
_ASBottomButtonState createState() => _ASBottomButtonState();
}
class _ASBottomButtonState extends State<ASBottomButton> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
width: widget.width ?? double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: widget.begin ?? Alignment.bottomRight,
end: widget.end ?? Alignment.topLeft,
colors: widget.colors ?? [widget.bgcolor, widget.bgcolor]),
),
child: MaterialButton(
onPressed: widget.onPressed,
textColor: widget.textColor ?? Color(0xFFFFFFFF),
disabledColor: widget.disableColor,
disabledTextColor: widget.disableTextColor,
padding: widget.padding ??
EdgeInsets.symmetric(
vertical: 13.w,
),
elevation: 0,
hoverElevation: 0,
highlightElevation: 0,
focusElevation: 0,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
child: widget.title is String
? Text(widget.title,
style: widget.textStyle ??
TextStyle(fontSize: 20.sp, fontWeight: FontWeight.bold))
: widget.title,
),
);
}
}

@ -125,15 +125,13 @@ class ASButton extends StatefulWidget {
this.outlineColor,
this.width,
}) : bgcolor = Color(0xFFFFBD32),
textColor=Color(0xFF0000000),
textStyle = TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.bold),
textColor = Color(0xFF0000000),
textStyle = TextStyle(fontSize: 14.sp, fontWeight: FontWeight.bold),
radius = 5.w,
outline = false,
disableColor = Color(0xFFFFDF9B),
disableTextColor = Color(0x73000000),
padding=EdgeInsets.symmetric(vertical: 8.w),
padding = EdgeInsets.symmetric(vertical: 8.w),
super(key: key);
@override
@ -144,17 +142,15 @@ class _ASButtonState extends State<ASButton> {
@override
Widget build(BuildContext context) {
return MaterialButton(
disabledColor: widget.disableColor ?? widget.bgcolor,
disabledTextColor: widget.disableTextColor ?? Color(0x73000000),
disabledColor: widget.disableColor,
disabledTextColor: widget.disableTextColor,
textColor: widget.textColor ?? Color(0xFFFFB600),
minWidth: widget.width ?? 75.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onPressed: widget.onPressed,
child: widget.title is String
? Text(widget.title,
style: widget.textStyle ??
TextStyle(
fontSize: 13.sp))
style: widget.textStyle ?? TextStyle(fontSize: 13.sp))
: widget.title,
padding: widget.padding ?? EdgeInsets.symmetric(vertical: 6.w),
shape: RoundedRectangleBorder(

@ -65,8 +65,8 @@ class ASGradientButton extends StatefulWidget {
radius = 19.w,
colors = [Color(0xFFF89B14), Color(0xFFF86B14)],
width = 100.w,
begin = Alignment.centerLeft,
end = Alignment.centerRight,
begin = Alignment.topCenter,
end = Alignment.bottomCenter,
padding = EdgeInsets.symmetric(vertical: 8.w),
super(key: key);
@ -100,16 +100,16 @@ class _ASGradientButtonState extends State<ASGradientButton> {
width: widget.width ?? 110.w,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: widget.begin ?? Alignment.centerLeft,
end: widget.end ?? Alignment.centerRight,
begin: widget.begin ?? Alignment.topCenter,
end: widget.end ?? Alignment.bottomCenter,
colors: widget.colors ?? [Color(0xFFFFA700), Color(0xFFFFBD00)],
),
borderRadius: BorderRadius.circular(widget.radius ?? 20.w),
),
child: MaterialButton(
disabledColor: widget.disableColor ?? Colors.grey,
disabledColor: widget.disableColor,
textColor: widget.textColor ?? Color(0xD9FFFFFF),
disabledTextColor: widget.disableTextColor ?? Color(0x73000000),
disabledTextColor: widget.disableTextColor,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onPressed: widget.onPressed,
child: widget.title is String

@ -95,9 +95,9 @@ class _ASLongButtonState extends State<ASLongButton> {
Widget build(BuildContext context) {
return MaterialButton(
minWidth: widget.width ?? 280.w,
disabledColor: widget.disableColor ?? widget.bgColor,
disabledColor: widget.disableColor,
textColor: widget.textColor ?? Color(0xFFFFFFFF),
disabledTextColor: widget.disableTextColor ?? Color(0x73000000),
disabledTextColor: widget.disableTextColor,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onPressed: widget.onPressed,
child: widget.title is String

Loading…
Cancel
Save