migrate ansu_ui to sound null-safety mode.

null_safety
小赖 4 years ago
parent 0c0c97c997
commit 146dedbe3f

@ -1,9 +1,7 @@
import 'package:ansu_ui/ansu_ui.dart'; import 'package:ansu_ui/ansu_ui.dart';
import 'package:example/codeviewer/code_segments.dart'; import 'package:example/codeviewer/code_segments.dart';
import 'package:example/common/code_view.dart';
import 'package:example/component/example_scaffold.dart'; import 'package:example/component/example_scaffold.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ExampleStringExt extends StatefulWidget { class ExampleStringExt extends StatefulWidget {
ExampleStringExt({Key key}) : super(key: key); ExampleStringExt({Key key}) : super(key: key);

@ -1,4 +1,3 @@
import 'package:example/extension/example_num_ext.dart';
import 'package:example/util_view/example_camera_view.dart'; import 'package:example/util_view/example_camera_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';

@ -13,7 +13,7 @@ class ExampleNumericButton extends StatefulWidget {
class _ExampleNumericButtonState extends State<ExampleNumericButton> { class _ExampleNumericButtonState extends State<ExampleNumericButton> {
_showSnack(BuildContext context, String title) { _showSnack(BuildContext context, String title) {
Scaffold.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(title)), SnackBar(content: Text(title)),
); );
} }

@ -14,7 +14,7 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: animator name: animator
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0"
ansu_ui: ansu_ui:
@ -28,84 +28,84 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.5.0" version: "2.5.0"
auto_size_text_pk: auto_size_text_pk:
dependency: transitive dependency: transitive
description: description:
name: auto_size_text_pk name: auto_size_text_pk
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0"
bot_toast: bot_toast:
dependency: transitive dependency: transitive
description: description:
name: bot_toast name: bot_toast
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.1" version: "4.0.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
cli_util: cli_util:
dependency: transitive dependency: transitive
description: description:
name: cli_util name: cli_util
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.3.0" version: "0.3.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.15.0" version: "1.15.0"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.2" version: "1.0.2"
expandable: expandable:
dependency: transitive dependency: transitive
description: description:
name: expandable name: expandable
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.0.1" version: "5.0.1"
file: file:
dependency: transitive dependency: transitive
description: description:
name: file name: file
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "6.1.0" version: "6.1.0"
flutter: flutter:
@ -131,14 +131,14 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: flutter_plugin_android_lifecycle name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
flutter_screenutil: flutter_screenutil:
dependency: transitive dependency: transitive
description: description:
name: flutter_screenutil name: flutter_screenutil
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.0.0" version: "5.0.0"
flutter_web_plugins: flutter_web_plugins:
@ -150,105 +150,105 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: get name: get
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.1.4" version: "4.1.4"
glob: glob:
dependency: transitive dependency: transitive
description: description:
name: glob name: glob
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
grinder: grinder:
dependency: "direct main" dependency: "direct main"
description: description:
name: grinder name: grinder
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.9.0" version: "0.9.0"
http: http:
dependency: transitive dependency: transitive
description: description:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.13.1" version: "0.13.1"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.0" version: "4.0.0"
image_picker: image_picker:
dependency: transitive dependency: transitive
description: description:
name: image_picker name: image_picker
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.7.4" version: "0.7.4"
image_picker_for_web: image_picker_for_web:
dependency: transitive dependency: transitive
description: description:
name: image_picker_for_web name: image_picker_for_web
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
image_picker_platform_interface: image_picker_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: image_picker_platform_interface name: image_picker_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
intl: intl:
dependency: transitive dependency: transitive
description: description:
name: intl name: intl
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.17.0" version: "0.17.0"
js: js:
dependency: transitive dependency: transitive
description: description:
name: js name: js
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.6.3" version: "0.6.3"
lpinyin: lpinyin:
dependency: transitive dependency: transitive
description: description:
name: lpinyin name: lpinyin
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.11.0" version: "1.11.0"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
sky_engine: sky_engine:
@ -260,56 +260,56 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.1" version: "1.8.1"
states_rebuilder: states_rebuilder:
dependency: transitive dependency: transitive
description: description:
name: states_rebuilder name: states_rebuilder
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.0+1" version: "4.0.0+1"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
velocity_x: velocity_x:
dependency: transitive dependency: transitive
description: description:
name: velocity_x name: velocity_x
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.6.1" version: "2.6.1"
vxstate: vxstate:
dependency: transitive dependency: transitive
description: description:
name: vxstate name: vxstate
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
sdks: sdks:

@ -5,17 +5,15 @@ import 'package:velocity_x/velocity_x.dart';
class ASBadge extends StatelessWidget { class ASBadge extends StatelessWidget {
final Widget child; final Widget child;
final String tag; final String? tag;
const ASBadge({Key key, @required this.child, this.tag}) const ASBadge({Key? key, required this.child, this.tag}) : super(key: key);
: assert(child != null),
super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return (tag?.length ?? 0) == 0 return (tag?.length ?? 0) == 0
? child ? child
: Stack( : Stack(
overflow: Overflow.visible, clipBehavior: Clip.none,
children: [ children: [
child, child,
Positioned( Positioned(
@ -36,7 +34,7 @@ class ASBadge extends StatelessWidget {
borderRadius: 8.radius, borderRadius: 8.radius,
), ),
height: 16.w, height: 16.w,
child: tag.text.white.size(10).make(), child: (tag ?? '').text.white.size(10).make(),
), ),
), ),
], ],

@ -5,7 +5,7 @@ import 'package:ansu_ui/styles/as_colors.dart';
class ASNavigationBar extends StatefulWidget { class ASNavigationBar extends StatefulWidget {
final List<BottomNavigationBarItem> items; final List<BottomNavigationBarItem> items;
final TabController controller; final TabController controller;
ASNavigationBar({Key key, @required this.items, this.controller}) ASNavigationBar({Key? key, required this.items,required this.controller})
: super(key: key); : super(key: key);
@override @override

@ -6,7 +6,7 @@ BottomNavigationBarItem asNavigationItem(
String path1, String path1,
String path2, String path2,
String title, { String title, {
String tag, String? tag,
}) { }) {
Widget icon = Image.asset( Widget icon = Image.asset(
path1, path1,

@ -9,44 +9,42 @@ class ASTabIndicator extends Decoration {
const ASTabIndicator({ const ASTabIndicator({
this.borderSide = const BorderSide(width: 4.0, color: Colors.white), this.borderSide = const BorderSide(width: 4.0, color: Colors.white),
this.insets = EdgeInsets.zero, this.insets = EdgeInsets.zero,
}) : assert(borderSide != null), });
assert(insets != null);
final BorderSide borderSide; final BorderSide borderSide;
final EdgeInsetsGeometry insets; final EdgeInsetsGeometry insets;
@override @override
Decoration lerpFrom(Decoration a, double t) { Decoration? lerpFrom(Decoration? a, double t) {
if (a is ASTabIndicator) { if (a is ASTabIndicator) {
return ASTabIndicator( return ASTabIndicator(
borderSide: BorderSide.lerp(a.borderSide, borderSide, t), borderSide: BorderSide.lerp(a.borderSide, borderSide, t),
insets: EdgeInsetsGeometry.lerp(a.insets, insets, t), insets: EdgeInsetsGeometry.lerp(a.insets, insets, t)!,
); );
} }
return super.lerpFrom(a, t); return super.lerpFrom(a, t);
} }
@override @override
Decoration lerpTo(Decoration b, double t) { Decoration? lerpTo(Decoration? b, double t) {
if (b is ASTabIndicator) { if (b is ASTabIndicator) {
return ASTabIndicator( return ASTabIndicator(
borderSide: BorderSide.lerp(borderSide, b.borderSide, t), borderSide: BorderSide.lerp(borderSide, b.borderSide, t),
insets: EdgeInsetsGeometry.lerp(insets, b.insets, t), insets: EdgeInsetsGeometry.lerp(insets, b.insets, t)!,
); );
} }
return super.lerpTo(b, t); return super.lerpTo(b, t);
} }
@override @override
_UnderlinePainter createBoxPainter([VoidCallback onChanged]) { _UnderlinePainter createBoxPainter([VoidCallback? onChanged]) {
return _UnderlinePainter(this, onChanged); return _UnderlinePainter(this, onChanged);
} }
} }
class _UnderlinePainter extends BoxPainter { class _UnderlinePainter extends BoxPainter {
_UnderlinePainter(this.decoration, VoidCallback onChanged) _UnderlinePainter(this.decoration, VoidCallback? onChanged)
: assert(decoration != null), : super(onChanged);
super(onChanged);
final ASTabIndicator decoration; final ASTabIndicator decoration;
@ -54,8 +52,6 @@ class _UnderlinePainter extends BoxPainter {
EdgeInsetsGeometry get insets => decoration.insets; EdgeInsetsGeometry get insets => decoration.insets;
Rect _indicatorRectFor(Rect rect, TextDirection textDirection) { Rect _indicatorRectFor(Rect rect, TextDirection textDirection) {
assert(rect != null);
assert(textDirection != null);
final Rect indicator = insets.resolve(textDirection).deflateRect(rect); final Rect indicator = insets.resolve(textDirection).deflateRect(rect);
return Rect.fromLTWH( return Rect.fromLTWH(
indicator.left, indicator.left,
@ -67,10 +63,9 @@ class _UnderlinePainter extends BoxPainter {
@override @override
void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {
assert(configuration != null);
assert(configuration.size != null); assert(configuration.size != null);
final Rect rect = offset & configuration.size; final Rect rect = offset & configuration.size!;
final TextDirection textDirection = configuration.textDirection; final TextDirection textDirection = configuration.textDirection!;
final Rect indicator = final Rect indicator =
_indicatorRectFor(rect, textDirection).deflate(borderSide.width / 2.0); _indicatorRectFor(rect, textDirection).deflate(borderSide.width / 2.0);
final Paint paint = borderSide.toPaint() final Paint paint = borderSide.toPaint()

@ -12,9 +12,9 @@ import 'package:velocity_x/velocity_x.dart';
/// [controller] see more TabController /// [controller] see more TabController
class ASTabBar extends StatelessWidget implements PreferredSizeWidget { class ASTabBar extends StatelessWidget implements PreferredSizeWidget {
///items ///items
final List<String> items; final List<String>? items;
final List<ASTabBarItem> tabItems; final List<ASTabBarItem>? tabItems;
/// TabController /// TabController
final TabController controller; final TabController controller;
@ -22,9 +22,9 @@ class ASTabBar extends StatelessWidget implements PreferredSizeWidget {
/// ///
final bool isScrollable; final bool isScrollable;
ASTabBar( ASTabBar(
{Key key, {Key? key,
@required this.items, required this.items,
@required this.controller, required this.controller,
this.isScrollable = false}) this.isScrollable = false})
: tabItems = null, : tabItems = null,
super(key: key); super(key: key);
@ -42,9 +42,9 @@ class ASTabBar extends StatelessWidget implements PreferredSizeWidget {
///``` ///```
/// ///
ASTabBar.tag( ASTabBar.tag(
{Key key, {Key? key,
@required this.tabItems, required this.tabItems,
@required this.controller, required this.controller,
this.isScrollable = false}) this.isScrollable = false})
: items = null, : items = null,
super(key: key); super(key: key);
@ -58,15 +58,15 @@ class ASTabBar extends StatelessWidget implements PreferredSizeWidget {
isScrollable: isScrollable, isScrollable: isScrollable,
controller: controller, controller: controller,
tabs: isTag tabs: isTag
? tabItems.map((e) { ? tabItems!.map((e) {
return Tab( return Tab(
child: ASBadge( child: ASBadge(
child: e.title.text.make(), child: e.title!.text.make(),
tag: e.tag, tag: e.tag,
), ),
); );
}).toList() }).toList()
: items : items!
.map((e) => Tab( .map((e) => Tab(
child: e.text.make(), child: e.text.make(),
)) ))

@ -1,6 +1,6 @@
class ASTabBarItem { class ASTabBarItem {
String title; String? title;
String tag; String? tag;
ASTabBarItem({ ASTabBarItem({
this.title, this.title,
this.tag, this.tag,

@ -8,12 +8,12 @@ class ASCheckBox extends StatelessWidget {
final bool checkStyle; final bool checkStyle;
/// ///
final Color color; final Color? color;
ASCheckBox({Key key, this.value = false, this.color}) ASCheckBox({Key? key, this.value = false, this.color})
: checkStyle = false, : checkStyle = false,
super(key: key); super(key: key);
ASCheckBox.checkStyle({Key key, this.value = false, this.color}) ASCheckBox.checkStyle({Key? key, this.value = false, this.color})
: checkStyle = true, : checkStyle = true,
super(key: key); super(key: key);

@ -9,9 +9,9 @@ import 'package:ansu_ui/styles/as_colors.dart';
///ASBackButton.white ///ASBackButton.white
class ASBackButton extends StatelessWidget { class ASBackButton extends StatelessWidget {
final Color color; final Color color;
const ASBackButton({Key key, this.color = kDarkColor}) : super(key: key); const ASBackButton({Key? key, this.color = kDarkColor}) : super(key: key);
const ASBackButton.white({Key key}) const ASBackButton.white({Key? key})
: color = kForegroundColor, : color = kForegroundColor,
super(key: key); super(key: key);

@ -7,40 +7,40 @@ class ASBottomButton extends StatelessWidget {
final dynamic title; final dynamic title;
/// ///
final Color bgcolor; final Color? bgcolor;
/// ///
final Color textColor; final Color? textColor;
/// ///
final TextStyle textStyle; final TextStyle? textStyle;
/// ///
final EdgeInsetsGeometry padding; final EdgeInsetsGeometry? padding;
/// ///
final Color disableColor; final Color? disableColor;
/// ///
final Color disableTextColor; final Color? disableTextColor;
/// ///
final double width; final double? width;
/// ///
final AlignmentGeometry begin; final AlignmentGeometry? begin;
/// ///
final AlignmentGeometry end; final AlignmentGeometry? end;
/// ///
final List<Color> colors; final List<Color>? colors;
/// ///
final VoidCallback onPressed; final VoidCallback? onPressed;
ASBottomButton( ASBottomButton(
{Key key, {Key? key,
this.title, this.title,
this.bgcolor, this.bgcolor,
this.textColor, this.textColor,
@ -56,8 +56,8 @@ class ASBottomButton extends StatelessWidget {
: super(key: key); : super(key: key);
ASBottomButton.infinity({ ASBottomButton.infinity({
Key key, Key? key,
@required this.title, required this.title,
this.onPressed, this.onPressed,
this.textStyle, this.textStyle,
this.padding, this.padding,
@ -72,8 +72,8 @@ class ASBottomButton extends StatelessWidget {
super(key: key); super(key: key);
ASBottomButton.gradient( ASBottomButton.gradient(
{Key key, {Key? key,
@required this.title, required this.title,
this.onPressed, this.onPressed,
this.bgcolor, this.bgcolor,
this.textStyle, this.textStyle,
@ -87,8 +87,8 @@ class ASBottomButton extends StatelessWidget {
width = double.infinity, width = double.infinity,
super(key: key); super(key: key);
ASBottomButton.shortWhite({ ASBottomButton.shortWhite({
Key key, Key? key,
@required this.title, required this.title,
this.onPressed, this.onPressed,
this.bgcolor, this.bgcolor,
this.textStyle, this.textStyle,
@ -101,7 +101,7 @@ class ASBottomButton extends StatelessWidget {
textColor = kPrimaryColor, textColor = kPrimaryColor,
width = double.infinity, width = double.infinity,
super(key: key); super(key: key);
Widget get _title { Widget? get _title {
if (title is String) if (title is String)
return Text( return Text(
title, title,
@ -123,7 +123,7 @@ class ASBottomButton extends StatelessWidget {
gradient: LinearGradient( gradient: LinearGradient(
begin: begin ?? Alignment.bottomRight, begin: begin ?? Alignment.bottomRight,
end: end ?? Alignment.topLeft, end: end ?? Alignment.topLeft,
colors: colors ?? [bgcolor, bgcolor], colors: colors ?? [bgcolor!, bgcolor!],
), ),
), ),
child: MaterialButton( child: MaterialButton(

@ -5,46 +5,46 @@ import 'package:ansu_ui/styles/as_colors.dart';
/// ///
class ASButton extends StatelessWidget { class ASButton extends StatelessWidget {
/// ///
final Color bgcolor; final Color? bgcolor;
/// ///
///stringwidget ///stringwidget
final dynamic title; final dynamic title;
/// ///
final double radius; final double? radius;
/// ///
final bool outline; final bool outline;
/// ///
final Color outlineColor; final Color? outlineColor;
/// ///
/// ///
final Color textColor; final Color? textColor;
/// ///
final TextStyle textStyle; final TextStyle? textStyle;
/// ///
final EdgeInsets padding; final EdgeInsets? padding;
/// ///
final VoidCallback onPressed; final VoidCallback? onPressed;
/// ///
final double width; final double? width;
/// ///
final Color disableColor; final Color? disableColor;
/// ///
final Color disableTextColor; final Color? disableTextColor;
final Color splashColor; final Color? splashColor;
ASButton({ ASButton({
Key key, Key? key,
this.bgcolor, this.bgcolor,
this.radius, this.radius,
this.outline = false, this.outline = false,
@ -52,7 +52,7 @@ class ASButton extends StatelessWidget {
this.textColor, this.textColor,
this.textStyle, this.textStyle,
this.padding, this.padding,
@required this.title, required this.title,
this.onPressed, this.onPressed,
this.width, this.width,
this.disableColor, this.disableColor,
@ -61,13 +61,13 @@ class ASButton extends StatelessWidget {
}) : super(key: key); }) : super(key: key);
ASButton.danger({ 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,
@ -78,12 +78,12 @@ class ASButton extends StatelessWidget {
super(key: key); super(key: key);
ASButton.info( ASButton.info(
{Key key, {Key? key,
this.bgcolor, this.bgcolor,
this.radius, this.radius,
this.textStyle, this.textStyle,
this.padding, this.padding,
@required this.title, required this.title,
this.onPressed, this.onPressed,
this.width, this.width,
this.disableColor, this.disableColor,
@ -95,12 +95,12 @@ class ASButton extends StatelessWidget {
super(key: key); super(key: key);
ASButton.warn({ ASButton.warn({
Key key, Key? key,
this.radius, this.radius,
this.outlineColor, this.outlineColor,
this.textStyle, this.textStyle,
this.padding, this.padding,
@required this.title, required this.title,
this.onPressed, this.onPressed,
this.width, this.width,
this.disableColor, this.disableColor,
@ -111,12 +111,12 @@ class ASButton extends StatelessWidget {
this.splashColor = ColorTool.getSplashColor(kPrimaryColor), this.splashColor = ColorTool.getSplashColor(kPrimaryColor),
super(key: key); super(key: key);
ASButton.operation( ASButton.operation(
{Key key, {Key? key,
this.radius, this.radius,
this.outlineColor, this.outlineColor,
this.textStyle, this.textStyle,
this.padding, this.padding,
@required this.title, required this.title,
this.onPressed, this.onPressed,
this.width, this.width,
this.disableColor, this.disableColor,
@ -127,8 +127,8 @@ class ASButton extends StatelessWidget {
outline = false, outline = false,
super(key: key); super(key: key);
ASButton.order({ ASButton.order({
Key key, Key? key,
@required this.title, required this.title,
this.onPressed, this.onPressed,
this.outlineColor, this.outlineColor,
this.width, this.width,
@ -159,12 +159,12 @@ class ASButton extends StatelessWidget {
shape: radius == null shape: radius == null
? StadiumBorder( ? StadiumBorder(
side: outline side: outline
? BorderSide(color: outlineColor, width: 0.5.w) ? BorderSide(color: outlineColor!, width: 0.5.w)
: BorderSide.none, : BorderSide.none,
) )
: RoundedRectangleBorder( : RoundedRectangleBorder(
side: outline side: outline
? BorderSide(color: outlineColor, width: 0.5.w) ? BorderSide(color: outlineColor!, width: 0.5.w)
: BorderSide.none, : BorderSide.none,
borderRadius: BorderRadius.circular(radius ?? 15.5.w)), borderRadius: BorderRadius.circular(radius ?? 15.5.w)),
color: bgcolor ?? kForegroundColor, color: bgcolor ?? kForegroundColor,

@ -9,40 +9,40 @@ class ASGradientButton extends StatelessWidget {
/// ///
/// ///
final Color textColor; final Color? textColor;
/// ///
final double radius; final double? radius;
/// ///
final TextStyle textStyle; final TextStyle? textStyle;
/// ///
final EdgeInsetsGeometry padding; final EdgeInsetsGeometry? padding;
/// ///
final VoidCallback onPressed; final VoidCallback? onPressed;
/// ///
final List<Color> colors; final List<Color>? colors;
/// ///
final AlignmentGeometry begin; final AlignmentGeometry? begin;
/// ///
final AlignmentGeometry end; final AlignmentGeometry? end;
/// ///
final double width; final double? width;
/// ///
final Color disableColor; final Color? disableColor;
/// ///
final Color disableTextColor; final Color? disableTextColor;
ASGradientButton( ASGradientButton(
{Key key, {Key? key,
@required this.title, required this.title,
this.textColor, this.textColor,
this.radius, this.radius,
this.textStyle, this.textStyle,
@ -56,8 +56,8 @@ class ASGradientButton extends StatelessWidget {
this.disableTextColor}) this.disableTextColor})
: super(key: key); : super(key: key);
ASGradientButton.pay({ ASGradientButton.pay({
Key key, Key? key,
@required this.title, required this.title,
this.textStyle, this.textStyle,
this.onPressed, this.onPressed,
this.disableColor, this.disableColor,
@ -72,8 +72,8 @@ class ASGradientButton extends StatelessWidget {
super(key: key); super(key: key);
ASGradientButton.operation( ASGradientButton.operation(
{Key key, {Key? key,
@required this.title, required this.title,
this.textColor, this.textColor,
this.onPressed, this.onPressed,
this.disableColor, this.disableColor,
@ -91,13 +91,13 @@ class ASGradientButton extends StatelessWidget {
super(key: key); super(key: key);
bool get isNullFunc => onPressed == null; bool get isNullFunc => onPressed == null;
List<Color> get _colors { List<Color>? get _colors {
if (colors == null) if (colors == null)
return null; return null;
else { else {
return List.generate( return List.generate(
colors.length, colors!.length,
(index) => colors[index].withOpacity(isNullFunc ? 0.5 : 1), (index) => colors![index].withOpacity(isNullFunc ? 0.5 : 1),
); );
} }
} }

@ -8,42 +8,42 @@ class ASLongButton extends StatelessWidget {
final dynamic title; final dynamic title;
/// ///
final Color bgColor; final Color? bgColor;
/// ///
/// ///
final Color textColor; final Color? textColor;
/// ///
final double radius; final double? radius;
/// ///
final TextStyle textStyle; final TextStyle? textStyle;
/// ///
final Padding padding; final Padding? padding;
/// ///
final bool outline; final bool outline;
/// ///
final Color outlineColor; final Color? outlineColor;
/// ///
final VoidCallback onPressed; final VoidCallback? onPressed;
/// ///
final double width; final double? width;
/// ///
final Color disableColor; final Color? disableColor;
/// ///
final Color disableTextColor; final Color? disableTextColor;
ASLongButton( ASLongButton(
{Key key, {Key? key,
@required this.title, required this.title,
this.bgColor, this.bgColor,
this.textColor, this.textColor,
this.radius, this.radius,
@ -58,12 +58,12 @@ class ASLongButton extends StatelessWidget {
: super(key: key); : super(key: key);
ASLongButton.solid({ ASLongButton.solid({
Key key, Key? key,
this.textStyle, this.textStyle,
this.padding, this.padding,
this.outlineColor, this.outlineColor,
this.radius, this.radius,
@required this.title, required this.title,
this.onPressed, this.onPressed,
this.width, this.width,
this.disableTextColor, this.disableTextColor,
@ -73,12 +73,12 @@ class ASLongButton extends StatelessWidget {
disableColor = Color(0xFFC1BDB5), disableColor = Color(0xFFC1BDB5),
super(key: key); super(key: key);
ASLongButton.hollow( ASLongButton.hollow(
{Key key, {Key? key,
this.radius, this.radius,
this.textStyle, this.textStyle,
this.padding, this.padding,
this.onPressed, this.onPressed,
@required this.title, required this.title,
this.width, this.width,
this.disableColor, this.disableColor,
this.disableTextColor}) this.disableTextColor})
@ -101,10 +101,10 @@ class ASLongButton extends StatelessWidget {
? Text(title, ? Text(title,
style: textStyle ?? TextStyle(fontSize: 20.sp)) style: textStyle ?? TextStyle(fontSize: 20.sp))
: title, : title,
padding: padding ?? EdgeInsets.symmetric(vertical: 8.w), padding: padding as EdgeInsetsGeometry? ?? EdgeInsets.symmetric(vertical: 8.w),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
side: outline side: outline
? BorderSide(color: outlineColor, width: 1.w) ? BorderSide(color: outlineColor!, width: 1.w)
: BorderSide.none, : BorderSide.none,
borderRadius: BorderRadius.circular(radius ?? 22.5.w)), borderRadius: BorderRadius.circular(radius ?? 22.5.w)),
color: bgColor ?? kForegroundColor, color: bgColor ?? kForegroundColor,

@ -14,30 +14,30 @@ import 'package:ansu_ui/extension/num_extension.dart';
/// ///
///padding = 0.edge ///padding = 0.edge
class ASMaterialButton extends StatelessWidget { class ASMaterialButton extends StatelessWidget {
final VoidCallback onPressed; final VoidCallback? onPressed;
final double height; final double? height;
final Widget icon; final Widget? icon;
final double radius; final double? radius;
final Widget child; final Widget child;
final EdgeInsets padding; final EdgeInsets? padding;
final Color color; final Color? color;
const ASMaterialButton({ const ASMaterialButton({
Key key, Key? key,
this.onPressed, this.onPressed,
this.height, this.height,
this.icon, this.icon,
@required this.child, required this.child,
this.radius, this.radius,
this.padding, this.padding,
this.color, this.color,
}) : super(key: key); }) : super(key: key);
ASMaterialButton.dropdown({ ASMaterialButton.dropdown({
Key key, Key? key,
this.onPressed, this.onPressed,
this.height, this.height,
@required this.child, required this.child,
this.radius, this.radius,
this.padding, this.padding,
this.color, this.color,
@ -63,7 +63,7 @@ class ASMaterialButton extends StatelessWidget {
children: [ children: [
child, child,
4.wb, 4.wb,
icon, icon!,
], ],
), ),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(

@ -23,25 +23,25 @@ class ASNumericButton extends StatefulWidget {
final int maxValue; final int maxValue;
/// ///
final String suffix; final String? suffix;
/// ///
final Function(int value) reachMax; final Function(int value)? reachMax;
/// ///
final Function(int value) reachMin; final Function(int value)? reachMin;
/// ///
final Function(int value) onChange; final Function(int value) onChange;
ASNumericButton({ ASNumericButton({
Key key, Key? key,
@required this.initValue, required this.initValue,
this.suffix, this.suffix,
this.minValue = 0, this.minValue = 0,
this.maxValue = 9999, this.maxValue = 9999,
this.reachMax, this.reachMax,
this.reachMin, this.reachMin,
@required this.onChange, required this.onChange,
}) : super(key: key); }) : super(key: key);
@override @override
@ -50,18 +50,18 @@ class ASNumericButton extends StatefulWidget {
class _ASNumericButtonState extends State<ASNumericButton> { class _ASNumericButtonState extends State<ASNumericButton> {
FocusNode _focusNode = FocusNode(); FocusNode _focusNode = FocusNode();
TextEditingController _controller; TextEditingController? _controller;
BorderSide _outline = BorderSide( BorderSide _outline = BorderSide(
color: Color(0xFFD8D4D4), color: Color(0xFFD8D4D4),
width: 1.w, width: 1.w,
); );
int _displayValue; late int _displayValue;
Widget _buildButton({ Widget _buildButton({
@required CustomPainter painter, required CustomPainter painter,
@required VoidCallback onPressed, required VoidCallback onPressed,
@required BorderRadius borderRadius, required BorderRadius borderRadius,
}) { }) {
return Container( return Container(
height: 32.w, height: 32.w,
@ -113,10 +113,10 @@ class _ASNumericButtonState extends State<ASNumericButton> {
if (_displayValue > widget.minValue) { if (_displayValue > widget.minValue) {
_displayValue--; _displayValue--;
widget.onChange(_displayValue); widget.onChange(_displayValue);
_controller.text = _displayValue.toString(); _controller!.text = _displayValue.toString();
setState(() {}); setState(() {});
} else { } else {
if (widget.reachMin != null) widget.reachMin(_displayValue); if (widget.reachMin != null) widget.reachMin!(_displayValue);
} }
}, },
borderRadius: BorderRadius.horizontal(left: Radius.circular(16.w)), borderRadius: BorderRadius.horizontal(left: Radius.circular(16.w)),
@ -134,7 +134,7 @@ class _ASNumericButtonState extends State<ASNumericButton> {
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
controller: _controller, controller: _controller,
onChanged: (text) { onChanged: (text) {
int value = int.tryParse(text); int? value = int.tryParse(text);
_displayValue = value ?? widget.initValue; _displayValue = value ?? widget.initValue;
setState(() {}); setState(() {});
widget.onChange(_displayValue); widget.onChange(_displayValue);
@ -173,10 +173,10 @@ class _ASNumericButtonState extends State<ASNumericButton> {
if (_displayValue < widget.maxValue) { if (_displayValue < widget.maxValue) {
_displayValue++; _displayValue++;
widget.onChange(_displayValue); widget.onChange(_displayValue);
_controller.text = _displayValue.toString(); _controller!.text = _displayValue.toString();
setState(() {}); setState(() {});
} else { } else {
if (widget.reachMax != null) widget.reachMax(_displayValue); if (widget.reachMax != null) widget.reachMax!(_displayValue);
} }
}, },
borderRadius: BorderRadius.horizontal(right: Radius.circular(16.w)), borderRadius: BorderRadius.horizontal(right: Radius.circular(16.w)),

@ -5,18 +5,18 @@ import 'package:ansu_ui/extension/num_extension.dart';
class ASRadioButton<T> extends StatefulWidget { class ASRadioButton<T> extends StatefulWidget {
/// ///
final T groupValue; final T? groupValue;
/// ///
final String title; final String? title;
/// ///
final T value; final T? value;
/// ///
final Function(T value) onTap; final Function(T value)? onTap;
ASRadioButton({ ASRadioButton({
Key key, Key? key,
this.groupValue, this.groupValue,
this.title, this.title,
this.value, this.value,
@ -32,7 +32,7 @@ class _ASRadioButtonState extends State<ASRadioButton> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(
onTap: () => widget.onTap(widget.value), onTap: () => widget.onTap!(widget.value),
borderRadius: 13.radius, borderRadius: 13.radius,
child: AnimatedContainer( child: AnimatedContainer(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
@ -40,7 +40,7 @@ class _ASRadioButtonState extends State<ASRadioButton> {
vertical: _selected ? 5.w : 4.w, vertical: _selected ? 5.w : 4.w,
), ),
child: AnimatedDefaultTextStyle( child: AnimatedDefaultTextStyle(
child: Text(widget.title), child: Text(widget.title!),
style: TextStyle( style: TextStyle(
color: _selected ? kLightTextColor : kTextSubColor, color: _selected ? kLightTextColor : kTextSubColor,
), ),

@ -11,8 +11,8 @@ import 'package:velocity_x/velocity_x.dart';
/// ///
///with auto cancel ///with auto cancel
class ASBottomDialog extends StatelessWidget { class ASBottomDialog extends StatelessWidget {
final List<Widget> items; final List<Widget>? items;
ASBottomDialog({Key key, @required this.items}) : super(key: key); ASBottomDialog({Key? key, required this.items}) : super(key: key);
_buildCancel(BuildContext context) { _buildCancel(BuildContext context) {
return ASMaterialButton( return ASMaterialButton(
@ -32,7 +32,7 @@ class ASBottomDialog extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
...items.sepWidget(separate: ASDivider()), ...items.sepWidget(separate: ASDivider())!,
10.hb, 10.hb,
_buildCancel(context), _buildCancel(context),
], ],

@ -7,8 +7,8 @@ import 'package:ansu_ui/extension/text_style_extension.dart';
///ASBottomDialog item ///ASBottomDialog item
class ASBottomDialogItem extends StatelessWidget { class ASBottomDialogItem extends StatelessWidget {
final Widget title; final Widget title;
final VoidCallback onPressed; final VoidCallback? onPressed;
const ASBottomDialogItem({Key key, @required this.title, this.onPressed}) const ASBottomDialogItem({Key? key, required this.title, this.onPressed})
: super(key: key); : super(key: key);
@override @override
@ -18,7 +18,7 @@ class ASBottomDialogItem extends StatelessWidget {
color: kForegroundColor, color: kForegroundColor,
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
onPressed(); onPressed!();
}, },
child: DefaultTextStyle( child: DefaultTextStyle(
style: TextStyle().black.bold.size(18), style: TextStyle().black.bold.size(18),

@ -7,19 +7,19 @@ import 'package:ansu_ui/dialog/as_dialog_button.dart';
class ASDeleteDialog extends StatelessWidget { class ASDeleteDialog extends StatelessWidget {
/// ///
final String title; final String? title;
/// ,widget /// ,widget
final dynamic body; final dynamic body;
/// ///
final Widget button; final Widget? button;
/// ///
final VoidCallback onpressed; final VoidCallback? onpressed;
const ASDeleteDialog( const ASDeleteDialog(
{Key key, this.title, this.body, this.button, this.onpressed}) {Key? key, this.title, this.body, this.button, this.onpressed})
: super(key: key); : super(key: key);
@override @override
@ -61,7 +61,7 @@ class ASDeleteDialog extends StatelessWidget {
: Container( : Container(
margin: EdgeInsets.only(bottom: 15.w), margin: EdgeInsets.only(bottom: 15.w),
child: Text( child: Text(
this.title, this.title!,
style: TextStyle( style: TextStyle(
color: kTextColor, color: kTextColor,
fontSize: 18.sp, fontSize: 18.sp,

@ -2,31 +2,30 @@ import 'package:flutter/cupertino.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';
import 'package:ansu_ui/styles/as_colors.dart'; import 'package:ansu_ui/styles/as_colors.dart';
import 'package:ansu_ui/extension/num_extension.dart';
import 'package:ansu_ui/extension/list_extension.dart'; import 'package:ansu_ui/extension/list_extension.dart';
class ASDialog extends StatelessWidget { class ASDialog extends StatelessWidget {
final bool close; final bool close;
/// ///
final List<Widget> items; final List<Widget>? items;
/// ///
final double spacer; final double? spacer;
final EdgeInsets padding; final EdgeInsets? padding;
final Widget child; final Widget child;
final EdgeInsets childPadding; final EdgeInsets? childPadding;
ASDialog({ ASDialog({
Key key, Key? key,
this.close = false, this.close = false,
this.items, this.items,
this.spacer, this.spacer,
this.padding, this.padding,
@required this.child, required this.child,
this.childPadding, this.childPadding,
}) : super(key: key); }) : super(key: key);
@ -75,7 +74,7 @@ class ASDialog extends StatelessWidget {
), ),
), ),
...items ...items
.sepWidget(separate: SizedBox(height: _widgetSpacer)), .sepWidget(separate: SizedBox(height: _widgetSpacer))!,
], ],
), ),
), ),

@ -3,14 +3,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:ansu_ui/buttons/as_long_button.dart'; import 'package:ansu_ui/buttons/as_long_button.dart';
class ASDialogButton extends StatelessWidget { class ASDialogButton extends StatelessWidget {
final String title; final String? title;
final VoidCallback onPressed; final VoidCallback? onPressed;
final bool outline; final bool outline;
const ASDialogButton( const ASDialogButton(
{Key key, this.title, this.onPressed, this.outline = false}) {Key? key, this.title, this.onPressed, this.outline = false})
: super(key: key); : super(key: key);
const ASDialogButton.outline({Key key, this.title, this.onPressed}) const ASDialogButton.outline({Key? key, this.title, this.onPressed})
: outline = true, : outline = true,
super(key: key); super(key: key);

@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
///`items` better with ASBottomDialogItem ///`items` better with ASBottomDialogItem
showASBottomDialog( showASBottomDialog(
BuildContext context, { BuildContext context, {
List<Widget> items, List<Widget>? items,
}) async { }) async {
return await showModalBottomSheet( return await showModalBottomSheet(
context: context, context: context,

@ -4,12 +4,12 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
///线 ///线
class ASDivider extends StatelessWidget { class ASDivider extends StatelessWidget {
final Color color; final Color color;
final double height; final double? height;
final double thickness; final double? thickness;
final double indent; final double? indent;
final double endIndent; final double? endIndent;
ASDivider({ ASDivider({
Key key, Key? key,
this.indent, this.indent,
this.endIndent, this.endIndent,
this.color = const Color(0xFFE9E9E9), this.color = const Color(0xFFE9E9E9),
@ -34,12 +34,12 @@ class ASDivider extends StatelessWidget {
/// 线 /// 线
class ASVDivider extends StatelessWidget { class ASVDivider extends StatelessWidget {
final Color color; final Color color;
final double width; final double? width;
final double thickness; final double? thickness;
final double indent; final double? indent;
final double endIndent; final double? endIndent;
ASVDivider({ ASVDivider({
Key key, Key? key,
this.indent, this.indent,
this.endIndent, this.endIndent,
this.color = const Color(0xFFE9E9E9), this.color = const Color(0xFFE9E9E9),

@ -8,7 +8,7 @@ import 'package:get/get.dart';
///pass a value through navigator. ///pass a value through navigator.
/// ///
///example `Navigator.pop(context,true)` or `Get.back(result:true)` ///example `Navigator.pop(context,true)` or `Get.back(result:true)`
Future<T> showASDrawer<T>(Widget drawer) async { Future<T?> showASDrawer<T>(Widget drawer) async {
return await Get.generalDialog( return await Get.generalDialog(
pageBuilder: (context, animation, secondAnimation) { pageBuilder: (context, animation, secondAnimation) {
return drawer; return drawer;
@ -39,7 +39,7 @@ class ASDrawer extends StatelessWidget {
///List Children ///List Children
/// ///
///ListView ///ListView
final List<Widget> children; final List<Widget>? children;
///Padding ///Padding
/// ///
@ -54,18 +54,18 @@ class ASDrawer extends StatelessWidget {
///left: 26.w, ///left: 26.w,
///right: 26.w, ///right: 26.w,
///``` ///```
final Widget bottom; final Widget? bottom;
/// ///
/// ///
///使`bottom``padding``children` ///使`bottom``padding``children`
final Widget child; final Widget? child;
/// ///
/// ///
///Padding `EdgeInsets.fromLTRB(26.w, 24.w, 26.w, 90.w)` ///Padding `EdgeInsets.fromLTRB(26.w, 24.w, 26.w, 90.w)`
ASDrawer({ ASDrawer({
Key key, Key? key,
this.children, this.children,
this.bottom, this.bottom,
this.child, this.child,
@ -76,7 +76,7 @@ class ASDrawer extends StatelessWidget {
///Padding ///Padding
ASDrawer.padding({ ASDrawer.padding({
Key key, Key? key,
this.padding = EdgeInsets.zero, this.padding = EdgeInsets.zero,
this.children, this.children,
this.child, this.child,
@ -100,7 +100,7 @@ class ASDrawer extends StatelessWidget {
children: [ children: [
ListView( ListView(
padding: padding, padding: padding,
children: children, children: children!,
), ),
Positioned( Positioned(
child: bottom ?? SizedBox(), child: bottom ?? SizedBox(),

@ -1,13 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ansu_ui/extension/num_extension.dart'; import 'package:ansu_ui/extension/num_extension.dart';
extension SeparateExt on List<Widget> { extension SeparateExt on List<Widget>? {
List<Widget> sepWidget({Widget separate}) { List<Widget>? sepWidget({Widget? separate}) {
if (this == null) return null; if (this == null) return null;
if (this.isEmpty) return []; if (this!.isEmpty) return [];
return List.generate(this.length * 2 - 1, (index) { return List.generate(this!.length * 2 - 1, (index) {
if (index.isEven) if (index.isEven)
return this[index ~/ 2]; return this![index ~/ 2];
else else
return separate ?? 10.wb; return separate ?? 10.wb;
}); });

@ -18,8 +18,8 @@ class ASCardExpandable extends StatefulWidget {
///childrenextraextrachildren ///childrenextraextrachildren
final bool custom; final bool custom;
ASCardExpandable({ ASCardExpandable({
Key key, Key? key,
@required this.title, required this.title,
this.children = const [], this.children = const [],
this.extra = const [], this.extra = const [],
this.mid = const [], this.mid = const [],
@ -28,8 +28,8 @@ class ASCardExpandable extends StatefulWidget {
///childrenextraextrachildren ///childrenextraextrachildren
ASCardExpandable.custom({ ASCardExpandable.custom({
Key key, Key? key,
@required this.title, required this.title,
this.children = const [], this.children = const [],
this.extra = const [], this.extra = const [],
this.mid = const [], this.mid = const [],
@ -40,7 +40,7 @@ class ASCardExpandable extends StatefulWidget {
_ASCardExpandableState createState() => _ASCardExpandableState(); _ASCardExpandableState createState() => _ASCardExpandableState();
static Widget tile( static Widget tile(
{@required String title, @required Widget child, Widget suffix}) { {required String title, required Widget child, Widget? suffix}) {
return Row( return Row(
textBaseline: TextBaseline.alphabetic, textBaseline: TextBaseline.alphabetic,
children: [ children: [
@ -109,14 +109,14 @@ class _ASCardExpandableState extends State<ASCardExpandable> {
children: [ children: [
SizedBox(), SizedBox(),
...widget.children, ...widget.children,
].sepWidget(separate: ASDivider(indent: 10.w, endIndent: 10.w)), ].sepWidget(separate: ASDivider(indent: 10.w, endIndent: 10.w))!,
), ),
expanded: Column( expanded: Column(
children: [ children: [
SizedBox(), SizedBox(),
...(widget.custom ? <Widget>[] : widget.children), ...(widget.custom ? <Widget>[] : widget.children),
...widget.extra, ...widget.extra,
].sepWidget(separate: ASDivider(indent: 10.w, endIndent: 10.w)), ].sepWidget(separate: ASDivider(indent: 10.w, endIndent: 10.w))!,
), ),
), ),
); );

@ -4,19 +4,19 @@ import 'package:ansu_ui/styles/as_colors.dart';
import 'package:ansu_ui/extension/num_extension.dart'; import 'package:ansu_ui/extension/num_extension.dart';
class ASEditTile extends StatelessWidget { class ASEditTile extends StatelessWidget {
final Widget title; final Widget? title;
final FocusNode node; final FocusNode? node;
final String hintText; final String? hintText;
final TextEditingController controller; final TextEditingController? controller;
ASEditTile({ ASEditTile({
Key key, Key? key,
this.title, this.title,
this.node, this.node,
this.hintText, this.hintText,
this.controller, this.controller,
}) : super(key: key); }) : super(key: key);
FocusNode _node; final FocusNode? _node = FocusNode();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(

@ -4,21 +4,21 @@ import 'package:ansu_ui/styles/as_colors.dart';
class ASListTile extends StatelessWidget { class ASListTile extends StatelessWidget {
/// ///
final String title; final String? title;
///widget ///widget
final dynamic text; final dynamic text;
/// ///
final Widget trail; final Widget? trail;
///32px ///32px
final double height; final double? height;
/// ///
final CrossAxisAlignment crossAxisAlignment; final CrossAxisAlignment? crossAxisAlignment;
ASListTile({ ASListTile({
Key key, Key? key,
this.title, this.title,
this.text, this.text,
this.trail, this.trail,
@ -26,7 +26,7 @@ class ASListTile extends StatelessWidget {
this.crossAxisAlignment, this.crossAxisAlignment,
}) : super(key: key); }) : super(key: key);
ASListTile.option({ ASListTile.option({
Key key, Key? key,
this.title, this.title,
this.text, this.text,
this.trail, this.trail,
@ -49,7 +49,7 @@ class ASListTile extends StatelessWidget {
Container( Container(
width: 85.w, width: 85.w,
child: Text( child: Text(
title, title!,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.visible, overflow: TextOverflow.visible,
softWrap: false, softWrap: false,

@ -4,14 +4,14 @@ import 'package:ansu_ui/extension/num_extension.dart';
class ASListTileX extends StatelessWidget { class ASListTileX extends StatelessWidget {
final Widget title; final Widget title;
final Widget suffix; final Widget? suffix;
final double height; final double? height;
final List<Widget> prefixes; final List<Widget>? prefixes;
final Widget child; final Widget? child;
final List<Widget> suffixes; final List<Widget>? suffixes;
const ASListTileX({ const ASListTileX({
Key key, Key? key,
@required this.title, required this.title,
this.suffix, this.suffix,
this.height, this.height,
this.prefixes, this.prefixes,

@ -6,32 +6,32 @@ import 'package:ansu_ui/divider/as_divider.dart';
///Tile ///Tile
class ASOptionTile extends StatelessWidget { class ASOptionTile extends StatelessWidget {
///使 ASOptionTileItem ///使 ASOptionTileItem
final List<Widget> items; final List<Widget>? items;
///Widget ///Widget
final Widget item; final Widget? item;
/// ///
final EdgeInsetsGeometry padding; final EdgeInsetsGeometry? padding;
/// ///
final dynamic leading; final dynamic leading;
///item 使`ASOptionTileItem`,`ASVerticalTileItem`,`ASListTile` ///item 使`ASOptionTileItem`,`ASVerticalTileItem`,`ASListTile`
ASOptionTile({Key key, this.items, this.item, this.padding, this.leading}) ASOptionTile({Key? key, this.items, this.item, this.padding, this.leading})
: super(key: key); : super(key: key);
///Tile ///Tile
ASOptionTile.single( ASOptionTile.single(
{Key key, @required this.item, this.padding, this.leading}) {Key? key, required this.item, this.padding, this.leading})
: items = [], : items = [],
super(key: key); super(key: key);
int get length => items.length; int get length => items!.length;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (this.leading != null) { if (this.leading != null) {
this.items.insert( this.items!.insert(
0, 0,
Container( Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
@ -61,7 +61,7 @@ class ASOptionTile extends StatelessWidget {
children: List.generate(length * 2 - 1, (index) { children: List.generate(length * 2 - 1, (index) {
final displayIndex = index ~/ 2; final displayIndex = index ~/ 2;
if (index.isEven) if (index.isEven)
return items[displayIndex]; return items![displayIndex];
else else
return this.padding == null return this.padding == null
? ASDivider(indent: 10.w, endIndent: 10.w) ? ASDivider(indent: 10.w, endIndent: 10.w)

@ -4,11 +4,11 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:ansu_ui/extension/num_extension.dart'; import 'package:ansu_ui/extension/num_extension.dart';
class ASOptionTileItem extends StatelessWidget { class ASOptionTileItem extends StatelessWidget {
final Widget leading; final Widget? leading;
final Widget title; final Widget? title;
final onPressed; final onPressed;
const ASOptionTileItem({ const ASOptionTileItem({
Key key, Key? key,
this.leading, this.leading,
this.title, this.title,
this.onPressed, this.onPressed,
@ -32,7 +32,7 @@ class ASOptionTileItem extends StatelessWidget {
color: Colors.black.withOpacity(0.65), color: Colors.black.withOpacity(0.65),
fontSize: 14.sp, fontSize: 14.sp,
), ),
child: title, child: title!,
), ),
), ),
14.wb, 14.wb,

@ -9,12 +9,12 @@ class ASVerticalTileItem extends StatelessWidget {
final Widget title; final Widget title;
///child ///child
final Widget child; final Widget? child;
final EdgeInsets padding; final EdgeInsets? padding;
ASVerticalTileItem({ ASVerticalTileItem({
Key key, Key? key,
@required this.title, required this.title,
this.child, this.child,
this.padding, this.padding,
}) : super(key: key); }) : super(key: key);
@ -43,7 +43,7 @@ class ASVerticalTileItem extends StatelessWidget {
), ),
13.hb, 13.hb,
ASDivider(), ASDivider(),
child, child!,
], ],
), ),
); );

@ -5,14 +5,14 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class ASCityPicker extends StatefulWidget { class ASCityPicker extends StatefulWidget {
ASCityPicker({Key key}) : super(key: key); ASCityPicker({Key? key}) : super(key: key);
@override @override
_ASCityPickerState createState() => _ASCityPickerState(); _ASCityPickerState createState() => _ASCityPickerState();
} }
class _ASCityPickerState extends State<ASCityPicker> { class _ASCityPickerState extends State<ASCityPicker> {
double getFontSize(String text) { double getFontSize(String? text) {
double fontSize = 13.sp; double fontSize = 13.sp;
int len = text?.length ?? 0; int len = text?.length ?? 0;
if (len >= 1 && len <= 3) { if (len >= 1 && len <= 3) {
@ -31,9 +31,9 @@ class _ASCityPickerState extends State<ASCityPicker> {
return fontSize; return fontSize;
} }
ProvinceModel _selectedProvince; late ProvinceModel _selectedProvince;
CityModel _selectedCity; late CityModel _selectedCity;
CityModel _selectedDistrict; CityModel? _selectedDistrict;
FixedExtentScrollController _cityController = FixedExtentScrollController(); FixedExtentScrollController _cityController = FixedExtentScrollController();
FixedExtentScrollController _districtController = FixedExtentScrollController _districtController =
@ -48,7 +48,7 @@ class _ASCityPickerState extends State<ASCityPicker> {
@override @override
void dispose() { void dispose() {
_cityController?.dispose(); _cityController.dispose();
super.dispose(); super.dispose();
} }
@ -88,7 +88,7 @@ class _ASCityPickerState extends State<ASCityPicker> {
children: CityUtil.provinceModel children: CityUtil.provinceModel
.map((e) => Center( .map((e) => Center(
child: Text( child: Text(
e.name, e.name!,
style: TextStyle( style: TextStyle(
fontSize: getFontSize(e.name), fontSize: getFontSize(e.name),
), ),
@ -122,7 +122,7 @@ class _ASCityPickerState extends State<ASCityPicker> {
children: CityUtil.getCityModelByCode(_selectedProvince.code) children: CityUtil.getCityModelByCode(_selectedProvince.code)
.map((e) => Center( .map((e) => Center(
child: Text( child: Text(
e.name, e.name!,
style: TextStyle( style: TextStyle(
fontSize: getFontSize(e.name), fontSize: getFontSize(e.name),
), ),
@ -146,7 +146,7 @@ class _ASCityPickerState extends State<ASCityPicker> {
children: CityUtil.getCityModelByCode(_selectedCity.code) children: CityUtil.getCityModelByCode(_selectedCity.code)
.map((e) => Center( .map((e) => Center(
child: Text( child: Text(
e.name, e.name!,
style: TextStyle( style: TextStyle(
fontSize: getFontSize(e.name), fontSize: getFontSize(e.name),
), ),

@ -5,14 +5,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
// //
class _ASDatePickerWidget extends StatefulWidget { class _ASDatePickerWidget extends StatefulWidget {
_ASDatePickerWidget({Key key}) : super(key: key); _ASDatePickerWidget({Key? key}) : super(key: key);
@override @override
_ASDatePickerWidgetState createState() => _ASDatePickerWidgetState(); _ASDatePickerWidgetState createState() => _ASDatePickerWidgetState();
} }
class _ASDatePickerWidgetState extends State<_ASDatePickerWidget> { class _ASDatePickerWidgetState extends State<_ASDatePickerWidget> {
DateTime _dateTime; DateTime? _dateTime;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -57,7 +57,7 @@ class _ASDatePickerWidgetState extends State<_ASDatePickerWidget> {
///```dart ///```dart
///Navigator.pop(context,dateTime) ///Navigator.pop(context,dateTime)
///``` ///```
Future<DateTime> asDatePicker(BuildContext context) async { Future<DateTime?> asDatePicker(BuildContext context) async {
return await showModalBottomSheet( return await showModalBottomSheet(
context: context, context: context,
builder: (context) { builder: (context) {

@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:ansu_ui/pickers/as_two_date_picker.dart'; import 'package:ansu_ui/pickers/as_two_date_picker.dart';
class RangeDate { class RangeDate {
DateTime start; DateTime? start;
DateTime end; DateTime? end;
RangeDate({ RangeDate({
this.start, this.start,
this.end, this.end,
@ -14,7 +14,7 @@ class RangeDate {
/// ///
///`RangeDate` ///`RangeDate`
Future<dynamic> show2DatePicker(BuildContext context, Future<dynamic> show2DatePicker(BuildContext context,
{bool isAnHour, RangeDate date}) async { {bool? isAnHour, RangeDate? date}) async {
return await showModalBottomSheet( return await showModalBottomSheet(
context: context, context: context,
builder: (context) { builder: (context) {

@ -4,22 +4,22 @@ import 'package:ansu_ui/styles/as_colors.dart';
import 'package:ansu_ui/divider/as_divider.dart'; import 'package:ansu_ui/divider/as_divider.dart';
class ASPickerBox extends StatelessWidget { class ASPickerBox extends StatelessWidget {
final VoidCallback onPressed; final VoidCallback? onPressed;
final String confirmString; final String confirmString;
final String title; final String? title;
final Widget child; final Widget child;
const ASPickerBox( const ASPickerBox(
{Key key, {Key? key,
this.onPressed, this.onPressed,
this.confirmString = '完成', this.confirmString = '完成',
this.title, this.title,
@required this.child}) required this.child})
: super(key: key); : super(key: key);
_buildButton({ _buildButton({
@required String title, required String title,
@required VoidCallback onPressed, required VoidCallback? onPressed,
}) { }) {
return TextButton( return TextButton(
style: ButtonStyle( style: ButtonStyle(

@ -2,8 +2,8 @@ import 'package:ansu_ui/utils/city_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ansu_ui/pickers/as_city_picker.dart'; import 'package:ansu_ui/pickers/as_city_picker.dart';
Future<CityModel> showCityPicker(BuildContext context, Future<CityModel?> showCityPicker(BuildContext context,
{String initCode}) async { {String? initCode}) async {
return await showModalBottomSheet( return await showModalBottomSheet(
context: context, context: context,
builder: (context) { builder: (context) {

@ -8,9 +8,9 @@ import 'package:ansu_ui/buttons/as_long_button.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class AS2DatePicker extends StatefulWidget { class AS2DatePicker extends StatefulWidget {
final bool isAnHour; final bool? isAnHour;
final RangeDate date; final RangeDate? date;
AS2DatePicker({Key key, this.isAnHour, this.date}) : super(key: key); AS2DatePicker({Key? key, this.isAnHour, this.date}) : super(key: key);
@override @override
_AS2DatePickerState createState() => _AS2DatePickerState(); _AS2DatePickerState createState() => _AS2DatePickerState();
@ -20,8 +20,8 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
int _selectedDay = 0; int _selectedDay = 0;
DateTime get now => DateTime.now(); DateTime get now => DateTime.now();
DateTime _selectedDate; DateTime? _selectedDate;
PageController _pageController; PageController? _pageController;
DateTimeRange get singleHour => DateTimeRange( DateTimeRange get singleHour => DateTimeRange(
start: now, start: now,
@ -99,8 +99,8 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
return ListView.builder( return ListView.builder(
padding: 8.edge, padding: 8.edge,
itemBuilder: (context, index) { itemBuilder: (context, index) {
bool sameItem = now.day == _selectedDate.day && bool sameItem = now.day == _selectedDate!.day &&
_selectedDate.hour == startHour + index; _selectedDate!.hour == startHour + index;
if (index == 0) { if (index == 0) {
return _renderButton( return _renderButton(
'一小时内', '一小时内',
@ -134,8 +134,8 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
return ListView.builder( return ListView.builder(
padding: 8.edge, padding: 8.edge,
itemBuilder: (context, index) { itemBuilder: (context, index) {
bool sameItem = (now.day + offsetDay) == _selectedDate.day && bool sameItem = (now.day + offsetDay) == _selectedDate!.day &&
_selectedDate.hour == index; _selectedDate!.hour == index;
return _renderButton( return _renderButton(
'$index\:00-${index + 1}:00', '$index\:00-${index + 1}:00',
() { () {
@ -220,7 +220,7 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
context, context,
RangeDate( RangeDate(
start: _selectedDate, start: _selectedDate,
end: _selectedDate.add(Duration(hours: 1)), end: _selectedDate!.add(Duration(hours: 1)),
)); ));
}, },
), ),

@ -10,12 +10,12 @@ import 'package:flutter/material.dart';
/// ], /// ],
/// ); /// );
/// ``` /// ```
Future<T> showASPopUpMenu<T>({ Future<T?> showASPopUpMenu<T>({
@required BuildContext context, required BuildContext context,
@required List<PopupMenuEntry<T>> items, required List<PopupMenuEntry<T>> items,
T initValue, T? initValue,
}) async { }) async {
final RenderBox renderBox = context.findRenderObject(); final RenderBox renderBox = context.findRenderObject() as RenderBox;
Size size = renderBox.size; Size size = renderBox.size;
return await showMenu( return await showMenu(
context: context, context: context,
@ -23,10 +23,10 @@ Future<T> showASPopUpMenu<T>({
position: RelativeRect.fromRect( position: RelativeRect.fromRect(
Rect.fromPoints( Rect.fromPoints(
renderBox.localToGlobal(Offset.zero, renderBox.localToGlobal(Offset.zero,
ancestor: Overlay.of(context).context.findRenderObject()), ancestor: Overlay.of(context)!.context.findRenderObject()),
renderBox.localToGlobal(size.bottomRight(Offset.zero)), renderBox.localToGlobal(size.bottomRight(Offset.zero)),
), ),
Offset.zero & Overlay.of(context).context.size, Offset.zero & Overlay.of(context)!.context.size!,
), ),
items: items, items: items,
shape: RoundedRectangleBorder(borderRadius: 10.radius), shape: RoundedRectangleBorder(borderRadius: 10.radius),

@ -4,16 +4,16 @@ import 'package:ansu_ui/styles/as_colors.dart';
class ASRefresh extends StatelessWidget { class ASRefresh extends StatelessWidget {
final Widget child; final Widget child;
final Future Function() onLoad; final Future Function()? onLoad;
final Future Function() onRefresh; final Future Function()? onRefresh;
final EasyRefreshController controller; final EasyRefreshController? controller;
final bool firstRefresh; final bool firstRefresh;
final Widget emptyWidget; final Widget? emptyWidget;
final Widget firstRefreshWidget; final Widget? firstRefreshWidget;
final ScrollController scrollController; final ScrollController? scrollController;
ASRefresh({ ASRefresh({
Key key, Key? key,
@required this.child, required this.child,
this.onLoad, this.onLoad,
this.onRefresh, this.onRefresh,
this.controller, this.controller,

@ -19,33 +19,33 @@ class ASScaffold extends StatelessWidget {
final dynamic title; final dynamic title;
/// `Scaffold` body /// `Scaffold` body
final Widget body; final Widget? body;
/// `Scaffold` leading /// `Scaffold` leading
final Widget leading; final Widget? leading;
/// `Scaffold` actions /// `Scaffold` actions
final List<Widget> actions; final List<Widget>? actions;
/// `Scaffold` bottomNavigationBar /// `Scaffold` bottomNavigationBar
final Widget bottomNavigationBar; final Widget? bottomNavigationBar;
/// `AppBar` appBarBottom /// `AppBar` appBarBottom
final PreferredSizeWidget appBarBottom; final PreferredSizeWidget? appBarBottom;
/// `EndDrawer` endDrawer /// `EndDrawer` endDrawer
/// ///
/// ///
final Widget endDrawer; final Widget? endDrawer;
/// `AppBar` appBar /// `AppBar` appBar
final Widget appBar; final Widget? appBar;
/// ///
final Color backgroundColor; final Color backgroundColor;
final Widget floatingActionButton; final Widget? floatingActionButton;
ASScaffold({ ASScaffold({
Key key, Key? key,
this.title, this.title,
this.leading, this.leading,
this.body, this.body,
@ -63,7 +63,7 @@ class ASScaffold extends StatelessWidget {
return title ?? SizedBox(); return title ?? SizedBox();
} }
Widget get _appBar { Widget? get _appBar {
if (title == null && appBar == null && appBarBottom == null) return null; if (title == null && appBar == null && appBarBottom == null) return null;
return appBar ?? return appBar ??
AppBar( AppBar(
@ -97,7 +97,7 @@ class ASScaffold extends StatelessWidget {
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
bottomNavigationBar: bottomNavigationBar, bottomNavigationBar: bottomNavigationBar,
floatingActionButton: floatingActionButton, floatingActionButton: floatingActionButton,
appBar: _appBar, appBar: _appBar as PreferredSizeWidget?,
body: body, body: body,
); );
} }

@ -37,7 +37,7 @@ const Color kLightTextColor = Color(0xD9FFFFFF);
const Color kSecondaryColor = Color(0xFFE50112); const Color kSecondaryColor = Color(0xFFE50112);
class ColorTool { class ColorTool {
static Color getSplashColor(Color color) { static Color getSplashColor(Color? color) {
if (color == null) return Colors.transparent; if (color == null) return Colors.transparent;
int r = color.red; int r = color.red;
int g = color.green; int g = color.green;

@ -7,9 +7,9 @@ class ASCheckTag extends StatelessWidget {
final bool checked; final bool checked;
final Widget text; final Widget text;
const ASCheckTag({ const ASCheckTag({
Key key, Key? key,
this.checked = false, this.checked = false,
@required this.text, required this.text,
}) : super(key: key); }) : super(key: key);
@override @override

@ -5,36 +5,36 @@ import 'package:ansu_ui/extension/num_extension.dart';
class ASTag extends StatelessWidget { class ASTag extends StatelessWidget {
/// ///
final double width; final double? width;
/// ///
final double height; final double? height;
/// ///
final Color bgColor; final Color? bgColor;
/// ///
final String text; final String? text;
/// ///
final Color textColor; final Color? textColor;
/// ///
final TextStyle textStyle; final TextStyle? textStyle;
/// ///
final bool outline; final bool outline;
/// ///
final Color outlineColor; final Color? outlineColor;
/// ///
final double radius; final double? radius;
/// ///
final EdgeInsetsGeometry padding; final EdgeInsetsGeometry? padding;
ASTag( ASTag(
{Key key, {Key? key,
this.width, this.width,
this.height, this.height,
this.bgColor, this.bgColor,
@ -48,7 +48,7 @@ class ASTag extends StatelessWidget {
: super(key: key); : super(key: key);
ASTag.yellowSolid(this.text, ASTag.yellowSolid(this.text,
{Key key, {Key? key,
this.width, this.width,
this.height, this.height,
this.textStyle, this.textStyle,
@ -62,7 +62,7 @@ class ASTag extends StatelessWidget {
ASTag.redHollow( ASTag.redHollow(
this.text, { this.text, {
Key key, Key? key,
this.width, this.width,
this.height, this.height,
this.textStyle, this.textStyle,
@ -75,7 +75,7 @@ class ASTag extends StatelessWidget {
super(key: key); super(key: key);
ASTag.yellowHollow(this.text, ASTag.yellowHollow(this.text,
{Key key, {Key? key,
this.width, this.width,
this.height, this.height,
this.textStyle, this.textStyle,
@ -88,7 +88,7 @@ class ASTag extends StatelessWidget {
super(key: key); super(key: key);
ASTag.yellowHollowS(this.text, ASTag.yellowHollowS(this.text,
{Key key, {Key? key,
this.width, this.width,
this.height, this.height,
this.textStyle, this.textStyle,
@ -99,7 +99,7 @@ class ASTag extends StatelessWidget {
outline = true, outline = true,
outlineColor = kDarkPrimaryColor, outlineColor = kDarkPrimaryColor,
super(key: key); super(key: key);
ASTag.transport(this.text, {Key key, this.textStyle, this.padding}) ASTag.transport(this.text, {Key? key, this.textStyle, this.padding})
: bgColor = kForegroundColor, : bgColor = kForegroundColor,
textColor = Color(0xFF00B0FF), textColor = Color(0xFF00B0FF),
outline = true, outline = true,
@ -131,7 +131,7 @@ class ASTag extends StatelessWidget {
), ),
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
text, text!,
style: textStyle ?? style: textStyle ??
TextStyle( TextStyle(
color: textColor, color: textColor,

@ -5,7 +5,7 @@ import 'package:ansu_ui/styles/as_colors.dart';
///TextFiled ///TextFiled
class ASSearchTextField extends StatefulWidget implements PreferredSizeWidget { class ASSearchTextField extends StatefulWidget implements PreferredSizeWidget {
ASSearchTextField({ ASSearchTextField({
Key key, Key? key,
this.controller, this.controller,
this.hintText, this.hintText,
this.onChanged, this.onChanged,
@ -19,7 +19,7 @@ class ASSearchTextField extends StatefulWidget implements PreferredSizeWidget {
/// ///
ASSearchTextField.button({ ASSearchTextField.button({
Key key, Key? key,
this.controller, this.controller,
this.hintText, this.hintText,
this.onChanged, this.onChanged,
@ -35,27 +35,27 @@ class ASSearchTextField extends StatefulWidget implements PreferredSizeWidget {
final bool button; final bool button;
/// ///
final TextEditingController controller; final TextEditingController? controller;
///hint Text ///hint Text
final String hintText; final String? hintText;
/// ///
final ValueChanged<String> onChanged; final ValueChanged<String>? onChanged;
/// ///
final ValueChanged<String> onSubmitted; final ValueChanged<String>? onSubmitted;
/// ///
final FocusNode focusNode; final FocusNode? focusNode;
///margin ///margin
final EdgeInsets margin; final EdgeInsets? margin;
final VoidCallback onPressed; final VoidCallback? onPressed;
/// ///
final double height; final double? height;
@override @override
_ASSearchTextFieldState createState() => _ASSearchTextFieldState(); _ASSearchTextFieldState createState() => _ASSearchTextFieldState();

@ -5,7 +5,7 @@ import 'package:image_picker/image_picker.dart';
import 'package:ansu_ui/utils/camera_view.dart'; import 'package:ansu_ui/utils/camera_view.dart';
/// ///
Future<File> camFile({double maxHeight = 3000, double maxWidth = 3000}) async { Future<File?> camFile({double maxHeight = 3000, double maxWidth = 3000}) async {
var pickedFile = await ImagePicker().getImage( var pickedFile = await ImagePicker().getImage(
source: ImageSource.camera, source: ImageSource.camera,
maxHeight: maxHeight, maxHeight: maxHeight,
@ -15,13 +15,13 @@ Future<File> camFile({double maxHeight = 3000, double maxWidth = 3000}) async {
return File(pickedFile.path); return File(pickedFile.path);
} }
Future<File> camView( Future<File?> camView(
BuildContext context, { BuildContext context, {
double maxHeight = 3000, double maxHeight = 3000,
double maxWidth = 3000, double maxWidth = 3000,
@required String title, required String title,
}) async { }) async {
File file = await camFile(maxHeight: maxHeight, maxWidth: maxWidth); File? file = await camFile(maxHeight: maxHeight, maxWidth: maxWidth);
if (file == null) return null; if (file == null) return null;
return await Navigator.push(context, PageRouteBuilder( return await Navigator.push(context, PageRouteBuilder(
pageBuilder: (context, animation, secondAnimation) { pageBuilder: (context, animation, secondAnimation) {

@ -13,16 +13,16 @@ import 'package:ansu_ui/divider/as_divider.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class CameraView extends StatefulWidget { class CameraView extends StatefulWidget {
final File file; final File? file;
final String title; final String? title;
CameraView({Key key, this.file, this.title}) : super(key: key); CameraView({Key? key, this.file, this.title}) : super(key: key);
@override @override
_CameraViewState createState() => _CameraViewState(); _CameraViewState createState() => _CameraViewState();
} }
class _CameraViewState extends State<CameraView> { class _CameraViewState extends State<CameraView> {
_buildButton({String title, Color color = kTextColor, onPressed}) { _buildButton({required String title, Color color = kTextColor, onPressed}) {
return MaterialButton( return MaterialButton(
child: title.text.bold.size(18).color(color).make(), child: title.text.bold.size(18).color(color).make(),
onPressed: onPressed, onPressed: onPressed,
@ -45,10 +45,10 @@ class _CameraViewState extends State<CameraView> {
}, },
child: Hero( child: Hero(
child: Image.file( child: Image.file(
widget.file, widget.file!,
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
tag: widget.title, tag: widget.title!,
), ),
), ),
), ),
@ -63,7 +63,7 @@ class _CameraViewState extends State<CameraView> {
_buildButton( _buildButton(
title: '重拍', title: '重拍',
onPressed: () async { onPressed: () async {
File file = await camFile(); File? file = await camFile();
if (file == null) if (file == null)
Navigator.pop(context); Navigator.pop(context);
else else
@ -86,7 +86,7 @@ class _CameraViewState extends State<CameraView> {
title: '确认', title: '确认',
onPressed: () => Navigator.pop(context, widget.file), onPressed: () => Navigator.pop(context, widget.file),
), ),
].sepWidget(separate: ASDivider()), ].sepWidget(separate: ASDivider())!,
), ),
), ),
); );

@ -10,16 +10,16 @@ class CityUtil {
.toList(); .toList();
} }
static List<CityModel> getCityModelByCode(String code) { static List<CityModel> getCityModelByCode(String? code) {
Map<String, dynamic> temp = citiesData[code]; Map<String, dynamic>? temp = citiesData[code!];
if (temp?.entries?.isEmpty ?? true) if (temp?.entries.isEmpty ?? true)
return [ return [
CityModel( CityModel(
code: code, code: code,
name: provincesData[code] ?? citiesData[code] ?? '', name: provincesData[code] ?? citiesData[code] ?? '',
) )
]; ];
return temp.entries return temp!.entries
.map((e) => CityModel( .map((e) => CityModel(
code: e.key, code: e.key,
name: e.value['name'], name: e.value['name'],
@ -29,8 +29,8 @@ class CityUtil {
} }
class ProvinceModel { class ProvinceModel {
String code; String? code;
String name; String? name;
ProvinceModel({ ProvinceModel({
this.code, this.code,
this.name, this.name,
@ -38,8 +38,8 @@ class ProvinceModel {
} }
class CityModel { class CityModel {
String code; String? code;
String name; String? name;
CityModel({ CityModel({
this.code, this.code,
this.name, this.name,

@ -4,9 +4,9 @@ import 'package:flutter/material.dart';
import 'package:ansu_ui/extension/num_extension.dart'; import 'package:ansu_ui/extension/num_extension.dart';
class PhotoViewer extends StatefulWidget { class PhotoViewer extends StatefulWidget {
final File file; final File? file;
final String tag; final String? tag;
PhotoViewer({Key key, this.file, this.tag}) : super(key: key); PhotoViewer({Key? key, this.file, this.tag}) : super(key: key);
@override @override
_PhotoViewerState createState() => _PhotoViewerState(); _PhotoViewerState createState() => _PhotoViewerState();
@ -23,8 +23,8 @@ class _PhotoViewerState extends State<PhotoViewer> {
child: InteractiveViewer( child: InteractiveViewer(
boundaryMargin: 100.edge, boundaryMargin: 100.edge,
child: Hero( child: Hero(
tag: widget.tag, tag: widget.tag!,
child: Image.file(widget.file), child: Image.file(widget.file!),
), ),
), ),
), ),
@ -33,7 +33,7 @@ class _PhotoViewerState extends State<PhotoViewer> {
} }
} }
toPhotoViewer(BuildContext context, {String tag, File file}) { toPhotoViewer(BuildContext context, {String? tag, File? file}) {
Navigator.push( Navigator.push(
context, context,
PageRouteBuilder( PageRouteBuilder(

@ -14,77 +14,77 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: animator name: animator
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.5.0" version: "2.5.0"
auto_size_text_pk: auto_size_text_pk:
dependency: transitive dependency: transitive
description: description:
name: auto_size_text_pk name: auto_size_text_pk
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
bot_toast: bot_toast:
dependency: "direct main" dependency: "direct main"
description: description:
name: bot_toast name: bot_toast
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.1" version: "4.0.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.15.0" version: "1.15.0"
expandable: expandable:
dependency: "direct main" dependency: "direct main"
description: description:
name: expandable name: expandable
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.0.1" version: "5.0.1"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
flutter: flutter:
@ -105,14 +105,14 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: flutter_plugin_android_lifecycle name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
flutter_screenutil: flutter_screenutil:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_screenutil name: flutter_screenutil
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.0.0" version: "5.0.0"
flutter_test: flutter_test:
@ -129,98 +129,98 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: get name: get
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.1.4" version: "4.1.4"
http: http:
dependency: transitive dependency: transitive
description: description:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.13.1" version: "0.13.1"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.0" version: "4.0.0"
image_picker: image_picker:
dependency: "direct main" dependency: "direct main"
description: description:
name: image_picker name: image_picker
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.7.4" version: "0.7.4"
image_picker_for_web: image_picker_for_web:
dependency: transitive dependency: transitive
description: description:
name: image_picker_for_web name: image_picker_for_web
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
image_picker_platform_interface: image_picker_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: image_picker_platform_interface name: image_picker_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
intl: intl:
dependency: transitive dependency: transitive
description: description:
name: intl name: intl
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.17.0" version: "0.17.0"
js: js:
dependency: transitive dependency: transitive
description: description:
name: js name: js
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.6.3" version: "0.6.3"
lpinyin: lpinyin:
dependency: "direct main" dependency: "direct main"
description: description:
name: lpinyin name: lpinyin
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.12.10" version: "0.12.10"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.11.0" version: "1.11.0"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
sky_engine: sky_engine:
@ -232,77 +232,77 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.10.0" version: "1.10.0"
states_rebuilder: states_rebuilder:
dependency: transitive dependency: transitive
description: description:
name: states_rebuilder name: states_rebuilder
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.0+1" version: "4.0.0+1"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.19" version: "0.2.19"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
velocity_x: velocity_x:
dependency: "direct main" dependency: "direct main"
description: description:
name: velocity_x name: velocity_x
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.6.1" version: "2.6.1"
vxstate: vxstate:
dependency: transitive dependency: transitive
description: description:
name: vxstate name: vxstate
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
sdks: sdks:

@ -4,7 +4,7 @@ version: 0.0.4
author: author:
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.17.0" flutter: ">=1.17.0"
dependencies: dependencies:

Loading…
Cancel
Save