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:flutter/material.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class ExampleDialog extends StatefulWidget {
@override
@ -42,12 +43,13 @@ class _ExampleDialogState extends State<ExampleDialog> {
));
}),
ListTile(
title: 'BOTTOM DIALOG'.text,
title: 'BOTTOM DIALOG'.text.make(),
onTap: () {
showASBottomDialog(
context,
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:flutter/material.dart';
import 'package:velocity_x/velocity_x.dart';
class ExamplePopUpMenu extends StatefulWidget {
ExamplePopUpMenu({Key key}) : super(key: key);
@ -17,20 +18,20 @@ class _ExamplePopUpMenuState extends State<ExamplePopUpMenu> {
children: [
SizedBox(height: 500),
ListTile(
title: 'PopUpMenu'.text,
title: 'PopUpMenu'.text.make(),
trailing: Builder(
builder: (context) {
return TextButton(
child: 'test'.text,
child: 'test'.text.make(),
onPressed: () {
showASPopUpMenu<int>(
context: context,
initValue: 3,
items: [
PopupMenuItem(child: 'test'.text, value: 1),
PopupMenuItem(child: 'test'.text, value: 2),
PopupMenuItem(child: 'test'.text, value: 3),
PopupMenuItem(child: 'test'.text, value: 4),
PopupMenuItem(child: 'test'.text.make(), value: 1),
PopupMenuItem(child: 'test'.text.make(), value: 2),
PopupMenuItem(child: 'test'.text.make(), value: 3),
PopupMenuItem(child: 'test'.text.make(), value: 4),
],
).then((value) {});
},

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

@ -1,6 +1,13 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
animator:
dependency: transitive
description:
name: animator
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.2"
ansu_ui:
dependency: "direct main"
description:
@ -22,6 +29,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dependency: transitive
description:
@ -226,6 +240,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dependency: transitive
description:
@ -254,6 +275,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dart: ">=2.10.0 <2.11.0"
flutter: ">=1.17.0 <2.0.0"

@ -68,5 +68,5 @@ export 'extension/list_extension.dart';
export 'extension/widget_extension.dart';
export 'extension/string_extension.dart';
export 'extension/text_style_extension.dart';
export 'extension/text_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:ansu_ui/extension/string_extension.dart';
import 'package:ansu_ui/extension/text_extension.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:ansu_ui/extension/num_extension.dart';
import 'package:velocity_x/velocity_x.dart';
class ASBadge extends StatelessWidget {
final Widget child;
@ -37,7 +36,7 @@ class ASBadge extends StatelessWidget {
borderRadius: 8.radius,
),
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:flutter/material.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
///
@ -69,14 +69,14 @@ class _ASTabBarState extends State<ASTabBar> {
? widget.tabItems.map((e) {
return Tab(
child: ASBadge(
child: e.title.text,
child: e.title.text.make(),
tag: e.tag,
),
);
}).toList()
: widget.items
.map((e) => Tab(
child: e.text,
child: e.text.make(),
))
.toList(),
labelStyle: TextStyle(

@ -2,9 +2,8 @@ import 'package:ansu_ui/ansu_ui.dart';
import 'package:ansu_ui/buttons/as_material_button.dart';
import 'package:flutter/material.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:velocity_x/velocity_x.dart';
///ASDialog
///
@ -26,7 +25,7 @@ class _ASBottomDialogState extends State<ASBottomDialog> {
onPressed: () {
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';
extension PhoneExt on String {
@ -32,8 +31,6 @@ extension PhoneExt on String {
return '${_parsePhone[0]}****${_parsePhone[2]}';
}
Text get text => Text(this);
get toast {
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_screenutil/flutter_screenutil.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/text_extension.dart';
import 'package:ansu_ui/extension/num_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/buttons/as_longbutton.dart';
import 'package:velocity_x/velocity_x.dart';
class AS2DatePicker extends StatefulWidget {
final bool isAnHour;
@ -50,9 +49,7 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
height: 70.w,
child: title.text.black
.size(16)
.copyWith(fontWeight: sameDay ? FontWeight.bold : FontWeight.normal),
child: title.text.black.size(16.sp).bold.make(),
);
}
@ -79,7 +76,7 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
children: [
30.wb,
AnimatedDefaultTextStyle(
child: title.text,
child: title.text.make(),
style: TextStyle().size(16).copyWith(
color: selected ? kSecondaryColor : kTextColor,
),

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

@ -1,6 +1,13 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
animator:
dependency: transitive
description:
name: animator
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.2"
async:
dependency: transitive
description:
@ -8,6 +15,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dependency: transitive
description:
@ -116,6 +130,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.16.1"
lpinyin:
dependency: "direct main"
description:
@ -177,6 +198,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dependency: transitive
description:
@ -219,6 +247,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.17.0 <2.0.0"

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

Loading…
Cancel
Save