remove text extension and add velocityX support.

null_safety
小赖 4 years ago
parent d6fab789d4
commit fffd6df484

@ -1,6 +1,7 @@
import 'package:ansu_ui/ansu_ui.dart'; import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class ExampleDialog extends StatefulWidget { class ExampleDialog extends StatefulWidget {
@override @override
@ -42,12 +43,13 @@ class _ExampleDialogState extends State<ExampleDialog> {
)); ));
}), }),
ListTile( ListTile(
title: 'BOTTOM DIALOG'.text, title: 'BOTTOM DIALOG'.text.make(),
onTap: () { onTap: () {
showASBottomDialog( showASBottomDialog(
context, context,
items: [ items: [
ASBottomDialogItem(title: 'TEST'.text, onPressed: () {}), ASBottomDialogItem(
title: 'TEST'.text.make(), onPressed: () {}),
], ],
); );
}, },

@ -1,5 +1,6 @@
import 'package:ansu_ui/ansu_ui.dart'; import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:velocity_x/velocity_x.dart';
class ExamplePopUpMenu extends StatefulWidget { class ExamplePopUpMenu extends StatefulWidget {
ExamplePopUpMenu({Key key}) : super(key: key); ExamplePopUpMenu({Key key}) : super(key: key);
@ -17,20 +18,20 @@ class _ExamplePopUpMenuState extends State<ExamplePopUpMenu> {
children: [ children: [
SizedBox(height: 500), SizedBox(height: 500),
ListTile( ListTile(
title: 'PopUpMenu'.text, title: 'PopUpMenu'.text.make(),
trailing: Builder( trailing: Builder(
builder: (context) { builder: (context) {
return TextButton( return TextButton(
child: 'test'.text, child: 'test'.text.make(),
onPressed: () { onPressed: () {
showASPopUpMenu<int>( showASPopUpMenu<int>(
context: context, context: context,
initValue: 3, initValue: 3,
items: [ items: [
PopupMenuItem(child: 'test'.text, value: 1), PopupMenuItem(child: 'test'.text.make(), value: 1),
PopupMenuItem(child: 'test'.text, value: 2), PopupMenuItem(child: 'test'.text.make(), value: 2),
PopupMenuItem(child: 'test'.text, value: 3), PopupMenuItem(child: 'test'.text.make(), value: 3),
PopupMenuItem(child: 'test'.text, value: 4), PopupMenuItem(child: 'test'.text.make(), value: 4),
], ],
).then((value) {}); ).then((value) {});
}, },

@ -2,6 +2,7 @@ import 'package:ansu_ui/ansu_ui.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:get/get.dart'; import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'codeviewer/code_segments.dart'; import 'codeviewer/code_segments.dart';
import 'common/code_view.dart'; import 'common/code_view.dart';
@ -80,7 +81,7 @@ class _ExampaleTagState extends State<ExampleTag> {
title: Text('ASCheckedTag'), title: Text('ASCheckedTag'),
trailing: ASCheckTag( trailing: ASCheckTag(
checked: _checked, checked: _checked,
text: 'TAG'.text, text: 'TAG'.text.make(),
), ),
), ),
// END // END

@ -1,6 +1,13 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
animator:
dependency: transitive
description:
name: animator
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.2"
ansu_ui: ansu_ui:
dependency: "direct main" dependency: "direct main"
description: description:
@ -22,6 +29,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.4.2" version: "2.4.2"
auto_size_text:
dependency: transitive
description:
name: auto_size_text
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
bot_toast: bot_toast:
dependency: transitive dependency: transitive
description: description:
@ -226,6 +240,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0-nullsafety.2" version: "1.8.0-nullsafety.2"
states_rebuilder:
dependency: transitive
description:
name: states_rebuilder
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.2.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
@ -254,6 +275,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0-nullsafety.3" version: "2.1.0-nullsafety.3"
velocity_x:
dependency: transitive
description:
name: velocity_x
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.1"
sdks: sdks:
dart: ">=2.10.0 <2.11.0" dart: ">=2.10.0 <2.11.0"
flutter: ">=1.17.0 <2.0.0" flutter: ">=1.17.0 <2.0.0"

@ -68,5 +68,5 @@ export 'extension/list_extension.dart';
export 'extension/widget_extension.dart'; export 'extension/widget_extension.dart';
export 'extension/string_extension.dart'; export 'extension/string_extension.dart';
export 'extension/text_style_extension.dart'; export 'extension/text_style_extension.dart';
export 'extension/text_extension.dart';
export 'extension/image_extension.dart'; export 'extension/image_extension.dart';
export 'package:velocity_x/velocity_x.dart';

@ -1,8 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ansu_ui/extension/string_extension.dart';
import 'package:ansu_ui/extension/text_extension.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:ansu_ui/extension/num_extension.dart'; import 'package:ansu_ui/extension/num_extension.dart';
import 'package:velocity_x/velocity_x.dart';
class ASBadge extends StatelessWidget { class ASBadge extends StatelessWidget {
final Widget child; final Widget child;
@ -37,7 +36,7 @@ class ASBadge extends StatelessWidget {
borderRadius: 8.radius, borderRadius: 8.radius,
), ),
height: 16.w, height: 16.w,
child: tag.text.white.size(10), child: tag.text.white.size(10).make(),
), ),
), ),
], ],

@ -3,7 +3,7 @@ import 'package:ansu_ui/bar/as_tab_indicator.dart';
import 'package:ansu_ui/bar/as_tabbar_item.dart'; import 'package:ansu_ui/bar/as_tabbar_item.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ansu_ui/styles/as_colors.dart'; import 'package:ansu_ui/styles/as_colors.dart';
import 'package:ansu_ui/extension/string_extension.dart'; import 'package:velocity_x/velocity_x.dart';
/// ## Tabbar /// ## Tabbar
/// ///
@ -69,14 +69,14 @@ class _ASTabBarState extends State<ASTabBar> {
? widget.tabItems.map((e) { ? widget.tabItems.map((e) {
return Tab( return Tab(
child: ASBadge( child: ASBadge(
child: e.title.text, child: e.title.text.make(),
tag: e.tag, tag: e.tag,
), ),
); );
}).toList() }).toList()
: widget.items : widget.items
.map((e) => Tab( .map((e) => Tab(
child: e.text, child: e.text.make(),
)) ))
.toList(), .toList(),
labelStyle: TextStyle( labelStyle: TextStyle(

@ -2,9 +2,8 @@ import 'package:ansu_ui/ansu_ui.dart';
import 'package:ansu_ui/buttons/as_material_button.dart'; import 'package:ansu_ui/buttons/as_material_button.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ansu_ui/styles/as_colors.dart'; import 'package:ansu_ui/styles/as_colors.dart';
import 'package:ansu_ui/extension/string_extension.dart';
import 'package:ansu_ui/extension/text_extension.dart';
import 'package:ansu_ui/extension/num_extension.dart'; import 'package:ansu_ui/extension/num_extension.dart';
import 'package:velocity_x/velocity_x.dart';
///ASDialog ///ASDialog
/// ///
@ -26,7 +25,7 @@ class _ASBottomDialogState extends State<ASBottomDialog> {
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
child: '取消'.text.bold.black.size(18), child: '取消'.text.black.size(18).make(),
); );
} }

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:ansu_ui/toast/as_toast.dart'; import 'package:ansu_ui/toast/as_toast.dart';
extension PhoneExt on String { extension PhoneExt on String {
@ -32,8 +31,6 @@ extension PhoneExt on String {
return '${_parsePhone[0]}****${_parsePhone[2]}'; return '${_parsePhone[0]}****${_parsePhone[2]}';
} }
Text get text => Text(this);
get toast { get toast {
ASToast.show(this); ASToast.show(this);
} }

@ -1,69 +0,0 @@
import 'package:flutter/material.dart';
import 'package:ansu_ui/extension/text_style_extension.dart';
extension TextExtension on Text {
Text get bold => Text(
this.data,
style: this.style?.bold ?? TextStyle().bold,
);
Text size(double size) {
return Text(
this.data,
style: this.style?.size(size) ?? TextStyle().size(size),
);
}
Text color(Color color) {
return Text(
this.data,
style: this.style?.colorX(color) ?? TextStyle().colorX(color),
);
}
Text height(double height) => Text(
this.data,
style: this.style?.heightX(height) ?? TextStyle().heightX(height),
);
Text get white =>
Text(this.data, style: this.style?.white ?? TextStyle().white);
Text get black =>
Text(this.data, style: this.style?.black ?? TextStyle().black);
Text get black65 =>
Text(this.data, style: this.style?.black65 ?? TextStyle().black65);
Text lines(int maxLines) {
return Text(
this.data,
maxLines: maxLines,
);
}
Text over(TextOverflow textOverflow) {
return Text(
this.data,
overflow: textOverflow,
);
}
Text get light => Text(
this.data,
style: this.style?.light ?? TextStyle().light,
);
Text copyWith({
FontWeight fontWeight,
Color color,
double fontSize,
}) {
return Text(this.data,
style: this.style.copyWith(
fontWeight: fontWeight,
color: color,
fontSize: fontSize,
));
}
}

@ -1,13 +1,12 @@
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/string_extension.dart';
import 'package:ansu_ui/extension/widget_extension.dart'; import 'package:ansu_ui/extension/widget_extension.dart';
import 'package:ansu_ui/extension/text_extension.dart';
import 'package:ansu_ui/extension/num_extension.dart'; import 'package:ansu_ui/extension/num_extension.dart';
import 'package:ansu_ui/extension/text_style_extension.dart'; import 'package:ansu_ui/extension/text_style_extension.dart';
import 'package:ansu_ui/pickers/as_date_range_picker_part.dart'; import 'package:ansu_ui/pickers/as_date_range_picker_part.dart';
import 'package:ansu_ui/buttons/as_longbutton.dart'; import 'package:ansu_ui/buttons/as_longbutton.dart';
import 'package:velocity_x/velocity_x.dart';
class AS2DatePicker extends StatefulWidget { class AS2DatePicker extends StatefulWidget {
final bool isAnHour; final bool isAnHour;
@ -50,9 +49,7 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
}, },
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
height: 70.w, height: 70.w,
child: title.text.black child: title.text.black.size(16.sp).bold.make(),
.size(16)
.copyWith(fontWeight: sameDay ? FontWeight.bold : FontWeight.normal),
); );
} }
@ -79,7 +76,7 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
children: [ children: [
30.wb, 30.wb,
AnimatedDefaultTextStyle( AnimatedDefaultTextStyle(
child: title.text, child: title.text.make(),
style: TextStyle().size(16).copyWith( style: TextStyle().size(16).copyWith(
color: selected ? kSecondaryColor : kTextColor, color: selected ? kSecondaryColor : kTextColor,
), ),

@ -5,13 +5,13 @@ 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/scaffold/as_scaffold.dart'; import 'package:ansu_ui/scaffold/as_scaffold.dart';
import 'package:ansu_ui/extension/string_extension.dart';
import 'package:ansu_ui/extension/text_extension.dart';
import 'package:ansu_ui/utils/photo_viewer.dart'; import 'package:ansu_ui/utils/photo_viewer.dart';
import 'package:ansu_ui/utils/camera_util.dart'; import 'package:ansu_ui/utils/camera_util.dart';
import 'package:ansu_ui/extension/list_extension.dart'; import 'package:ansu_ui/extension/list_extension.dart';
import 'package:ansu_ui/divider/as_divider.dart'; import 'package:ansu_ui/divider/as_divider.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;
@ -24,7 +24,7 @@ class CameraView extends StatefulWidget {
class _CameraViewState extends State<CameraView> { class _CameraViewState extends State<CameraView> {
_buildButton({String title, Color color = kTextColor, onPressed}) { _buildButton({String title, Color color = kTextColor, onPressed}) {
return MaterialButton( return MaterialButton(
child: title.text.bold.size(18).copyWith(color: color), child: title.text.bold.size(18).color(color).make(),
onPressed: onPressed, onPressed: onPressed,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
height: 48.w, height: 48.w,

@ -1,6 +1,13 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
animator:
dependency: transitive
description:
name: animator
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.2"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -8,6 +15,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.5.0-nullsafety.1" version: "2.5.0-nullsafety.1"
auto_size_text:
dependency: transitive
description:
name: auto_size_text
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -116,6 +130,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.16.1"
lpinyin: lpinyin:
dependency: "direct main" dependency: "direct main"
description: description:
@ -177,6 +198,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.10.0-nullsafety.1" version: "1.10.0-nullsafety.1"
states_rebuilder:
dependency: transitive
description:
name: states_rebuilder
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.2.0"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
@ -219,6 +247,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0-nullsafety.3" version: "2.1.0-nullsafety.3"
velocity_x:
dependency: "direct main"
description:
name: velocity_x
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.1"
sdks: sdks:
dart: ">=2.10.0-110 <2.11.0" dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.17.0 <2.0.0" flutter: ">=1.17.0 <2.0.0"

@ -15,7 +15,8 @@ dependencies:
lpinyin: ^1.1.0 lpinyin: ^1.1.0
image_picker: ^0.6.7+15 image_picker: ^0.6.7+15
bot_toast: ^3.0.5 bot_toast: ^3.0.5
velocity_x:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter

Loading…
Cancel
Save