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:example/codeviewer/code_segments.dart';
import 'package:example/common/code_view.dart';
import 'package:example/component/example_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ExampleStringExt extends StatefulWidget {
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:flutter/material.dart';
import 'package:get/get.dart';

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

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

@ -5,17 +5,15 @@ import 'package:velocity_x/velocity_x.dart';
class ASBadge extends StatelessWidget {
final Widget child;
final String tag;
const ASBadge({Key key, @required this.child, this.tag})
: assert(child != null),
super(key: key);
final String? tag;
const ASBadge({Key? key, required this.child, this.tag}) : super(key: key);
@override
Widget build(BuildContext context) {
return (tag?.length ?? 0) == 0
? child
: Stack(
overflow: Overflow.visible,
clipBehavior: Clip.none,
children: [
child,
Positioned(
@ -36,7 +34,7 @@ class ASBadge extends StatelessWidget {
borderRadius: 8.radius,
),
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 {
final List<BottomNavigationBarItem> items;
final TabController controller;
ASNavigationBar({Key key, @required this.items, this.controller})
ASNavigationBar({Key? key, required this.items,required this.controller})
: super(key: key);
@override

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

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

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

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

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

@ -9,9 +9,9 @@ import 'package:ansu_ui/styles/as_colors.dart';
///ASBackButton.white
class ASBackButton extends StatelessWidget {
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,
super(key: key);

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

@ -5,46 +5,46 @@ import 'package:ansu_ui/styles/as_colors.dart';
///
class ASButton extends StatelessWidget {
///
final Color bgcolor;
final Color? bgcolor;
///
///stringwidget
final dynamic title;
///
final double radius;
final double? radius;
///
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({
Key key,
Key? key,
this.bgcolor,
this.radius,
this.outline = false,
@ -52,7 +52,7 @@ class ASButton extends StatelessWidget {
this.textColor,
this.textStyle,
this.padding,
@required this.title,
required this.title,
this.onPressed,
this.width,
this.disableColor,
@ -61,13 +61,13 @@ class ASButton extends StatelessWidget {
}) : super(key: key);
ASButton.danger({
Key key,
Key? key,
this.textStyle,
this.padding,
this.radius,
this.bgcolor,
this.onPressed,
@required this.title,
required this.title,
this.width,
this.disableColor,
this.disableTextColor,
@ -78,12 +78,12 @@ class ASButton extends StatelessWidget {
super(key: key);
ASButton.info(
{Key key,
{Key? key,
this.bgcolor,
this.radius,
this.textStyle,
this.padding,
@required this.title,
required this.title,
this.onPressed,
this.width,
this.disableColor,
@ -95,12 +95,12 @@ class ASButton extends StatelessWidget {
super(key: key);
ASButton.warn({
Key key,
Key? key,
this.radius,
this.outlineColor,
this.textStyle,
this.padding,
@required this.title,
required this.title,
this.onPressed,
this.width,
this.disableColor,
@ -111,12 +111,12 @@ class ASButton extends StatelessWidget {
this.splashColor = ColorTool.getSplashColor(kPrimaryColor),
super(key: key);
ASButton.operation(
{Key key,
{Key? key,
this.radius,
this.outlineColor,
this.textStyle,
this.padding,
@required this.title,
required this.title,
this.onPressed,
this.width,
this.disableColor,
@ -127,8 +127,8 @@ class ASButton extends StatelessWidget {
outline = false,
super(key: key);
ASButton.order({
Key key,
@required this.title,
Key? key,
required this.title,
this.onPressed,
this.outlineColor,
this.width,
@ -159,12 +159,12 @@ class ASButton extends StatelessWidget {
shape: radius == null
? StadiumBorder(
side: outline
? BorderSide(color: outlineColor, width: 0.5.w)
? BorderSide(color: outlineColor!, width: 0.5.w)
: BorderSide.none,
)
: RoundedRectangleBorder(
side: outline
? BorderSide(color: outlineColor, width: 0.5.w)
? BorderSide(color: outlineColor!, width: 0.5.w)
: BorderSide.none,
borderRadius: BorderRadius.circular(radius ?? 15.5.w)),
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(
{Key key,
@required this.title,
{Key? key,
required this.title,
this.textColor,
this.radius,
this.textStyle,
@ -56,8 +56,8 @@ class ASGradientButton extends StatelessWidget {
this.disableTextColor})
: super(key: key);
ASGradientButton.pay({
Key key,
@required this.title,
Key? key,
required this.title,
this.textStyle,
this.onPressed,
this.disableColor,
@ -72,8 +72,8 @@ class ASGradientButton extends StatelessWidget {
super(key: key);
ASGradientButton.operation(
{Key key,
@required this.title,
{Key? key,
required this.title,
this.textColor,
this.onPressed,
this.disableColor,
@ -91,13 +91,13 @@ class ASGradientButton extends StatelessWidget {
super(key: key);
bool get isNullFunc => onPressed == null;
List<Color> get _colors {
List<Color>? get _colors {
if (colors == null)
return null;
else {
return List.generate(
colors.length,
(index) => colors[index].withOpacity(isNullFunc ? 0.5 : 1),
colors!.length,
(index) => colors![index].withOpacity(isNullFunc ? 0.5 : 1),
);
}
}

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

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

@ -23,25 +23,25 @@ class ASNumericButton extends StatefulWidget {
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;
ASNumericButton({
Key key,
@required this.initValue,
Key? key,
required this.initValue,
this.suffix,
this.minValue = 0,
this.maxValue = 9999,
this.reachMax,
this.reachMin,
@required this.onChange,
required this.onChange,
}) : super(key: key);
@override
@ -50,18 +50,18 @@ class ASNumericButton extends StatefulWidget {
class _ASNumericButtonState extends State<ASNumericButton> {
FocusNode _focusNode = FocusNode();
TextEditingController _controller;
TextEditingController? _controller;
BorderSide _outline = BorderSide(
color: Color(0xFFD8D4D4),
width: 1.w,
);
int _displayValue;
late int _displayValue;
Widget _buildButton({
@required CustomPainter painter,
@required VoidCallback onPressed,
@required BorderRadius borderRadius,
required CustomPainter painter,
required VoidCallback onPressed,
required BorderRadius borderRadius,
}) {
return Container(
height: 32.w,
@ -113,10 +113,10 @@ class _ASNumericButtonState extends State<ASNumericButton> {
if (_displayValue > widget.minValue) {
_displayValue--;
widget.onChange(_displayValue);
_controller.text = _displayValue.toString();
_controller!.text = _displayValue.toString();
setState(() {});
} else {
if (widget.reachMin != null) widget.reachMin(_displayValue);
if (widget.reachMin != null) widget.reachMin!(_displayValue);
}
},
borderRadius: BorderRadius.horizontal(left: Radius.circular(16.w)),
@ -134,7 +134,7 @@ class _ASNumericButtonState extends State<ASNumericButton> {
keyboardType: TextInputType.number,
controller: _controller,
onChanged: (text) {
int value = int.tryParse(text);
int? value = int.tryParse(text);
_displayValue = value ?? widget.initValue;
setState(() {});
widget.onChange(_displayValue);
@ -173,10 +173,10 @@ class _ASNumericButtonState extends State<ASNumericButton> {
if (_displayValue < widget.maxValue) {
_displayValue++;
widget.onChange(_displayValue);
_controller.text = _displayValue.toString();
_controller!.text = _displayValue.toString();
setState(() {});
} else {
if (widget.reachMax != null) widget.reachMax(_displayValue);
if (widget.reachMax != null) widget.reachMax!(_displayValue);
}
},
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 {
///
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({
Key key,
Key? key,
this.groupValue,
this.title,
this.value,
@ -32,7 +32,7 @@ class _ASRadioButtonState extends State<ASRadioButton> {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () => widget.onTap(widget.value),
onTap: () => widget.onTap!(widget.value),
borderRadius: 13.radius,
child: AnimatedContainer(
padding: EdgeInsets.symmetric(
@ -40,7 +40,7 @@ class _ASRadioButtonState extends State<ASRadioButton> {
vertical: _selected ? 5.w : 4.w,
),
child: AnimatedDefaultTextStyle(
child: Text(widget.title),
child: Text(widget.title!),
style: TextStyle(
color: _selected ? kLightTextColor : kTextSubColor,
),

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

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

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

@ -2,31 +2,30 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.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';
class ASDialog extends StatelessWidget {
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 EdgeInsets childPadding;
final EdgeInsets? childPadding;
ASDialog({
Key key,
Key? key,
this.close = false,
this.items,
this.spacer,
this.padding,
@required this.child,
required this.child,
this.childPadding,
}) : super(key: key);
@ -75,7 +74,7 @@ class ASDialog extends StatelessWidget {
),
),
...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';
class ASDialogButton extends StatelessWidget {
final String title;
final VoidCallback onPressed;
final String? title;
final VoidCallback? onPressed;
final bool outline;
const ASDialogButton(
{Key key, this.title, this.onPressed, this.outline = false})
{Key? key, this.title, this.onPressed, this.outline = false})
: super(key: key);
const ASDialogButton.outline({Key key, this.title, this.onPressed})
const ASDialogButton.outline({Key? key, this.title, this.onPressed})
: outline = true,
super(key: key);

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

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

@ -8,7 +8,7 @@ import 'package:get/get.dart';
///pass a value through navigator.
///
///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(
pageBuilder: (context, animation, secondAnimation) {
return drawer;
@ -39,7 +39,7 @@ class ASDrawer extends StatelessWidget {
///List Children
///
///ListView
final List<Widget> children;
final List<Widget>? children;
///Padding
///
@ -54,18 +54,18 @@ class ASDrawer extends StatelessWidget {
///left: 26.w,
///right: 26.w,
///```
final Widget bottom;
final Widget? bottom;
///
///
///使`bottom``padding``children`
final Widget child;
final Widget? child;
///
///
///Padding `EdgeInsets.fromLTRB(26.w, 24.w, 26.w, 90.w)`
ASDrawer({
Key key,
Key? key,
this.children,
this.bottom,
this.child,
@ -76,7 +76,7 @@ class ASDrawer extends StatelessWidget {
///Padding
ASDrawer.padding({
Key key,
Key? key,
this.padding = EdgeInsets.zero,
this.children,
this.child,
@ -100,7 +100,7 @@ class ASDrawer extends StatelessWidget {
children: [
ListView(
padding: padding,
children: children,
children: children!,
),
Positioned(
child: bottom ?? SizedBox(),

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

@ -18,8 +18,8 @@ class ASCardExpandable extends StatefulWidget {
///childrenextraextrachildren
final bool custom;
ASCardExpandable({
Key key,
@required this.title,
Key? key,
required this.title,
this.children = const [],
this.extra = const [],
this.mid = const [],
@ -28,8 +28,8 @@ class ASCardExpandable extends StatefulWidget {
///childrenextraextrachildren
ASCardExpandable.custom({
Key key,
@required this.title,
Key? key,
required this.title,
this.children = const [],
this.extra = const [],
this.mid = const [],
@ -40,7 +40,7 @@ class ASCardExpandable extends StatefulWidget {
_ASCardExpandableState createState() => _ASCardExpandableState();
static Widget tile(
{@required String title, @required Widget child, Widget suffix}) {
{required String title, required Widget child, Widget? suffix}) {
return Row(
textBaseline: TextBaseline.alphabetic,
children: [
@ -109,14 +109,14 @@ class _ASCardExpandableState extends State<ASCardExpandable> {
children: [
SizedBox(),
...widget.children,
].sepWidget(separate: ASDivider(indent: 10.w, endIndent: 10.w)),
].sepWidget(separate: ASDivider(indent: 10.w, endIndent: 10.w))!,
),
expanded: Column(
children: [
SizedBox(),
...(widget.custom ? <Widget>[] : widget.children),
...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';
class ASEditTile extends StatelessWidget {
final Widget title;
final FocusNode node;
final String hintText;
final TextEditingController controller;
final Widget? title;
final FocusNode? node;
final String? hintText;
final TextEditingController? controller;
ASEditTile({
Key key,
Key? key,
this.title,
this.node,
this.hintText,
this.controller,
}) : super(key: key);
FocusNode _node;
final FocusNode? _node = FocusNode();
@override
Widget build(BuildContext context) {
return GestureDetector(

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

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

@ -6,32 +6,32 @@ import 'package:ansu_ui/divider/as_divider.dart';
///Tile
class ASOptionTile extends StatelessWidget {
///使 ASOptionTileItem
final List<Widget> items;
final List<Widget>? items;
///Widget
final Widget item;
final Widget? item;
///
final EdgeInsetsGeometry padding;
final EdgeInsetsGeometry? padding;
///
final dynamic leading;
///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);
///Tile
ASOptionTile.single(
{Key key, @required this.item, this.padding, this.leading})
{Key? key, required this.item, this.padding, this.leading})
: items = [],
super(key: key);
int get length => items.length;
int get length => items!.length;
@override
Widget build(BuildContext context) {
if (this.leading != null) {
this.items.insert(
this.items!.insert(
0,
Container(
alignment: Alignment.centerLeft,
@ -61,7 +61,7 @@ class ASOptionTile extends StatelessWidget {
children: List.generate(length * 2 - 1, (index) {
final displayIndex = index ~/ 2;
if (index.isEven)
return items[displayIndex];
return items![displayIndex];
else
return this.padding == null
? 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';
class ASOptionTileItem extends StatelessWidget {
final Widget leading;
final Widget title;
final Widget? leading;
final Widget? title;
final onPressed;
const ASOptionTileItem({
Key key,
Key? key,
this.leading,
this.title,
this.onPressed,
@ -32,7 +32,7 @@ class ASOptionTileItem extends StatelessWidget {
color: Colors.black.withOpacity(0.65),
fontSize: 14.sp,
),
child: title,
child: title!,
),
),
14.wb,

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

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

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

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

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

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

@ -8,9 +8,9 @@ import 'package:ansu_ui/buttons/as_long_button.dart';
import 'package:velocity_x/velocity_x.dart';
class AS2DatePicker extends StatefulWidget {
final bool isAnHour;
final RangeDate date;
AS2DatePicker({Key key, this.isAnHour, this.date}) : super(key: key);
final bool? isAnHour;
final RangeDate? date;
AS2DatePicker({Key? key, this.isAnHour, this.date}) : super(key: key);
@override
_AS2DatePickerState createState() => _AS2DatePickerState();
@ -20,8 +20,8 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
int _selectedDay = 0;
DateTime get now => DateTime.now();
DateTime _selectedDate;
PageController _pageController;
DateTime? _selectedDate;
PageController? _pageController;
DateTimeRange get singleHour => DateTimeRange(
start: now,
@ -99,8 +99,8 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
return ListView.builder(
padding: 8.edge,
itemBuilder: (context, index) {
bool sameItem = now.day == _selectedDate.day &&
_selectedDate.hour == startHour + index;
bool sameItem = now.day == _selectedDate!.day &&
_selectedDate!.hour == startHour + index;
if (index == 0) {
return _renderButton(
'一小时内',
@ -134,8 +134,8 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
return ListView.builder(
padding: 8.edge,
itemBuilder: (context, index) {
bool sameItem = (now.day + offsetDay) == _selectedDate.day &&
_selectedDate.hour == index;
bool sameItem = (now.day + offsetDay) == _selectedDate!.day &&
_selectedDate!.hour == index;
return _renderButton(
'$index\:00-${index + 1}:00',
() {
@ -220,7 +220,7 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
context,
RangeDate(
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>({
@required BuildContext context,
@required List<PopupMenuEntry<T>> items,
T initValue,
Future<T?> showASPopUpMenu<T>({
required BuildContext context,
required List<PopupMenuEntry<T>> items,
T? initValue,
}) async {
final RenderBox renderBox = context.findRenderObject();
final RenderBox renderBox = context.findRenderObject() as RenderBox;
Size size = renderBox.size;
return await showMenu(
context: context,
@ -23,10 +23,10 @@ Future<T> showASPopUpMenu<T>({
position: RelativeRect.fromRect(
Rect.fromPoints(
renderBox.localToGlobal(Offset.zero,
ancestor: Overlay.of(context).context.findRenderObject()),
ancestor: Overlay.of(context)!.context.findRenderObject()),
renderBox.localToGlobal(size.bottomRight(Offset.zero)),
),
Offset.zero & Overlay.of(context).context.size,
Offset.zero & Overlay.of(context)!.context.size!,
),
items: items,
shape: RoundedRectangleBorder(borderRadius: 10.radius),

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save