dart migrate

flutter upgrade to 2.2.0
master
张萌 3 years ago
parent 2ca1997739
commit 6ead6aced6

@ -0,0 +1,4 @@
{
"flutterSdkVersion": "2.2.0",
"flavors": {}
}

@ -14,19 +14,19 @@ class CodeStyle extends InheritedWidget {
this.punctuationStyle,
this.classStyle,
this.constantStyle,
@required Widget child,
required Widget child,
}) : super(child: child);
final TextStyle baseStyle;
final TextStyle numberStyle;
final TextStyle commentStyle;
final TextStyle keywordStyle;
final TextStyle stringStyle;
final TextStyle punctuationStyle;
final TextStyle classStyle;
final TextStyle constantStyle;
final TextStyle? baseStyle;
final TextStyle? numberStyle;
final TextStyle? commentStyle;
final TextStyle? keywordStyle;
final TextStyle? stringStyle;
final TextStyle? punctuationStyle;
final TextStyle? classStyle;
final TextStyle? constantStyle;
static CodeStyle of(BuildContext context) {
static CodeStyle? of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<CodeStyle>();
}

@ -6,12 +6,12 @@ import 'code_view.dart';
class BasePage extends StatelessWidget {
final String title;
final Widget body;
final List<Widget> actions;
final CodeBuilder codeBuilder;
final List<Widget>? actions;
final CodeBuilder? codeBuilder;
const BasePage(
{Key key,
@required this.title,
@required this.body,
{Key? key,
required this.title,
required this.body,
this.actions,
this.codeBuilder})
: super(key: key);

@ -4,10 +4,10 @@ import 'package:get/get.dart';
import 'code_view.dart';
class CodeTile extends StatelessWidget {
final Widget title;
final Widget subTitle;
final CodeBuilder builder;
const CodeTile({Key key, this.title, this.subTitle, this.builder})
final Widget? title;
final Widget? subTitle;
final CodeBuilder? builder;
const CodeTile({Key? key, this.title, this.subTitle, this.builder})
: super(key: key);
@override

@ -5,9 +5,9 @@ import '../codeviewer/code_style.dart';
typedef CodeBuilder = TextSpan Function(BuildContext context);
class CodeView extends StatefulWidget {
final CodeBuilder text;
final CodeBuilder? text;
final String title;
CodeView({Key key, @required this.text, this.title = 'Code'})
CodeView({Key? key, required this.text, this.title = 'Code'})
: super(key: key);
@override
@ -33,7 +33,7 @@ class _CodeViewState extends State<CodeView> {
classStyle: codeTheme.copyWith(color: Colors.yellow),
constantStyle: codeTheme.copyWith(color: Colors.pink),
child:
Builder(builder: (context) => Text.rich(widget.text(context))),
Builder(builder: (context) => Text.rich(widget.text!(context))),
)),
);
}

@ -5,13 +5,13 @@ import 'package:get/get.dart';
class ExampleScaffold extends StatelessWidget {
final String title;
final CodeBuilder text;
final CodeBuilder? text;
final List<Widget> children;
const ExampleScaffold({
Key key,
@required this.title,
Key? key,
required this.title,
this.text,
@required this.children,
required this.children,
}) : super(key: key);
@override

@ -2,9 +2,9 @@ import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter/material.dart';
class ColorObject {
Color color;
String name;
String codeName;
Color? color;
String? name;
String? codeName;
ColorObject({
this.color,
this.name,

@ -6,7 +6,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class ExampleListExt extends StatefulWidget {
const ExampleListExt({Key key}) : super(key: key);
const ExampleListExt({Key? key}) : super(key: key);
@override
_ExampleListExtState createState() => _ExampleListExtState();

@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ExampleNumExt extends StatefulWidget {
ExampleNumExt({Key key}) : super(key: key);
ExampleNumExt({Key? key}) : super(key: key);
@override
_ExampleNumExtState createState() => _ExampleNumExtState();

@ -4,7 +4,7 @@ import 'package:example/component/example_scaffold.dart';
import 'package:flutter/material.dart';
class ExampleStringExt extends StatefulWidget {
ExampleStringExt({Key key}) : super(key: key);
ExampleStringExt({Key? key}) : super(key: key);
@override
_ExampleStringExtState createState() => _ExampleStringExtState();

@ -37,14 +37,14 @@ class MyApp extends StatelessWidget {
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key}) : super(key: key);
MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
TabController _tabController;
TabController? _tabController;
@override
void initState() {
@ -56,9 +56,9 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
print(Theme.of(context).textTheme.headline1.fontFamily);
print(Theme.of(context).textTheme.headline1!.fontFamily);
return ASScaffold(
leading: navigator.canPop()
leading: navigator!.canPop()
? IconButton(
icon: Icon(Icons.backpack, color: Colors.black),
onPressed: () {},
@ -74,7 +74,7 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
],
),
bottomNavigationBar: ASNavigationBar(
controller: _tabController,
controller: _tabController!,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home),

@ -6,7 +6,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class MainExtention extends StatefulWidget {
MainExtention({Key key}) : super(key: key);
MainExtention({Key? key}) : super(key: key);
@override
_MainExtentionState createState() => _MainExtentionState();
@ -14,9 +14,9 @@ class MainExtention extends StatefulWidget {
class _MainExtentionState extends State<MainExtention> {
_innerButton({
VoidCallback onPressed,
Widget child,
Widget icon,
VoidCallback? onPressed,
required Widget child,
Widget? icon,
}) {
return TextButton(
onPressed: onPressed,

@ -21,7 +21,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class MainHome extends StatefulWidget {
MainHome({Key key}) : super(key: key);
MainHome({Key? key}) : super(key: key);
@override
_MainHomeState createState() => _MainHomeState();
@ -29,15 +29,15 @@ class MainHome extends StatefulWidget {
class _MainHomeState extends State<MainHome> {
_innerButton({
VoidCallback onPressed,
String title,
IconData icon,
VoidCallback? onPressed,
required String title,
IconData? icon,
}) {
return TextButton(
onPressed: onPressed,
child: Row(
children: [
Expanded(child: Icon(icon) ?? SizedBox()),
Expanded(child: icon != null ? Icon(icon) : SizedBox()),
Text(title),
Spacer(),
],

@ -4,7 +4,7 @@ import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class MainUtils extends StatefulWidget {
MainUtils({Key key}) : super(key: key);
MainUtils({Key? key}) : super(key: key);
@override
_MainUtilsState createState() => _MainUtilsState();
@ -12,9 +12,9 @@ class MainUtils extends StatefulWidget {
class _MainUtilsState extends State<MainUtils> {
_innerButton({
VoidCallback onPressed,
Widget child,
Widget icon,
VoidCallback? onPressed,
required Widget child,
Widget? icon,
}) {
return TextButton(
onPressed: onPressed,

@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'package:velocity_x/velocity_x.dart';
class ExampleCameraView extends StatefulWidget {
ExampleCameraView({Key key}) : super(key: key);
ExampleCameraView({Key? key}) : super(key: key);
@override
_ExampleCameraViewState createState() => _ExampleCameraViewState();
@ -24,8 +24,8 @@ class _ExampleCameraViewState extends State<ExampleCameraView> {
ListTile(
title: 'CameraView'.text.make(),
onTap: () async {
File file = await camView(context, title: 'TEST');
print(await file.length());
File? file = await camView(context, title: 'TEST');
print(await file?.length());
},
),
// END

@ -8,7 +8,7 @@ import 'package:get/get.dart';
class ExampleBottomButton extends StatefulWidget {
ExampleBottomButton({Key key}) : super(key: key);
ExampleBottomButton({Key? key}) : super(key: key);
@override
_ExampleBottomButtonState createState() => _ExampleBottomButtonState();

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ExampleBox extends StatefulWidget {
ExampleBox({Key key}) : super(key: key);
ExampleBox({Key? key}) : super(key: key);
@override
_ExampleBoxState createState() => _ExampleBoxState();

@ -7,7 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class ExampleButton extends StatefulWidget {
ExampleButton({Key key}) : super(key: key);
ExampleButton({Key? key}) : super(key: key);
@override
_ExampleButtonState createState() => _ExampleButtonState();
@ -153,25 +153,25 @@ class _ExampleButtonState extends State<ExampleButton> {
groupValue: groupValue,
value: 0,
title: '候选0',
onTap: (_) => setState(() => groupValue = 0),
onTap: (dynamic _) => setState(() => groupValue = 0),
),
ASRadioButton(
groupValue: groupValue,
value: 1,
title: '候选1',
onTap: (_) => setState(() => groupValue = 1),
onTap: (dynamic _) => setState(() => groupValue = 1),
),
ASRadioButton(
groupValue: groupValue,
value: 2,
title: '候选2',
onTap: (_) => setState(() => groupValue = 2),
onTap: (dynamic _) => setState(() => groupValue = 2),
),
ASRadioButton(
groupValue: groupValue,
value: 3,
title: '候选3',
onTap: (_) => setState(() => groupValue = 3),
onTap: (dynamic _) => setState(() => groupValue = 3),
),
],
),

@ -3,7 +3,7 @@ import 'package:ansu_ui/chart/circle_chart_widget.dart';
import 'package:flutter/material.dart';
class ExampleChart extends StatefulWidget {
const ExampleChart({Key key}) : super(key: key);
const ExampleChart({Key? key}) : super(key: key);
@override
_ExampleChartState createState() => _ExampleChartState();

@ -3,7 +3,7 @@ import 'package:ansu_ui/divider/as_dotted_divider.dart';
import 'package:flutter/material.dart';
class ExampleDivider extends StatefulWidget {
ExampleDivider({Key key}) : super(key: key);
ExampleDivider({Key? key}) : super(key: key);
@override
_ExampleDividerState createState() => _ExampleDividerState();

@ -2,7 +2,7 @@ import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter/material.dart';
class ExampleDrawer extends StatefulWidget {
ExampleDrawer({Key key}) : super(key: key);
ExampleDrawer({Key? key}) : super(key: key);
@override
_ExampleDrawerState createState() => _ExampleDrawerState();

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ExampleListTile extends StatefulWidget {
ExampleListTile({Key key}) : super(key: key);
ExampleListTile({Key? key}) : super(key: key);
@override
_ExampleListTileState createState() => _ExampleListTileState();

@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ExampleNumericButton extends StatefulWidget {
ExampleNumericButton({Key key}) : super(key: key);
ExampleNumericButton({Key? key}) : super(key: key);
@override
_ExampleNumericButtonState createState() => _ExampleNumericButtonState();

@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ExamplePicker extends StatefulWidget {
ExamplePicker({Key key}) : super(key: key);
ExamplePicker({Key? key}) : super(key: key);
@override
_ExamplePickerState createState() => _ExamplePickerState();
@ -40,7 +40,7 @@ class _ExamplePickerState extends State<ExamplePicker> {
trailing: ASButton(
title: '日期选择器',
onPressed: () async {
DateTime date = await asDatePicker(context);
DateTime? date = await asDatePicker(context);
Get.snackbar(date.toString(), 'MESSAGE');
},
),
@ -75,8 +75,8 @@ class _ExamplePickerState extends State<ExamplePicker> {
trailing: ASButton(
title: '图片选择器',
onPressed: () async {
File file = await camView(context, title: '图片选择器');
print(file.lengthSync());
File? file = await camView(context, title: '图片选择器');
print(file?.lengthSync());
},
),
),
@ -86,7 +86,7 @@ class _ExamplePickerState extends State<ExamplePicker> {
trailing: ASButton(
title: '图片选择器',
onPressed: () async {
File file = await pickImageFile();
File? file = await pickImageFile();
},
),
),

@ -3,14 +3,14 @@ import 'package:flutter/material.dart';
import 'package:velocity_x/velocity_x.dart';
class ExamplePopUpMenu extends StatefulWidget {
ExamplePopUpMenu({Key key}) : super(key: key);
ExamplePopUpMenu({Key? key}) : super(key: key);
@override
_ExamplePopUpMenuState createState() => _ExamplePopUpMenuState();
}
class _ExamplePopUpMenuState extends State<ExamplePopUpMenu> {
int _value;
int? _value;
@override
Widget build(BuildContext context) {
return ASScaffold(
@ -25,7 +25,7 @@ class _ExamplePopUpMenuState extends State<ExamplePopUpMenu> {
return TextButton(
child: '$_value'.text.make(),
onPressed: () async {
int result = await showASPopUpMenu<int>(
int? result = await showASPopUpMenu<int>(
context: context,
initValue: _value,
items: List.generate(

@ -2,7 +2,7 @@ import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter/material.dart';
class ExampleRefresh extends StatefulWidget {
ExampleRefresh({Key key}) : super(key: key);
ExampleRefresh({Key? key}) : super(key: key);
@override
_ExampleRefreshState createState() => _ExampleRefreshState();

@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ExampleScaffold extends StatefulWidget {
ExampleScaffold({Key key}) : super(key: key);
ExampleScaffold({Key? key}) : super(key: key);
@override
_ExampleScaffoldState createState() => _ExampleScaffoldState();
@ -14,15 +14,15 @@ class ExampleScaffold extends StatefulWidget {
class _ExampleScaffoldState extends State<ExampleScaffold>
with TickerProviderStateMixin {
TabController _tabController;
List<String> tabs;
late TabController _tabController;
List<String>? tabs;
@override
void initState() {
super.initState();
tabs = List.generate(10, (index) => 'Tab $index');
_tabController = TabController(
length: tabs.length,
length: tabs!.length,
vsync: this,
);
}

@ -4,7 +4,7 @@ import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ExampleStyleColor extends StatefulWidget {
ExampleStyleColor({Key key}) : super(key: key);
ExampleStyleColor({Key? key}) : super(key: key);
@override
_ExampleStyleColorState createState() => _ExampleStyleColorState();
@ -26,7 +26,7 @@ class _ExampleStyleColorState extends State<ExampleStyleColor> {
],
),
),
subtitle: Text(object.codeName),
subtitle: Text(object.codeName!),
trailing: Card(
color: object.color,
child: SizedBox(height: 50.w, width: 50.w),

@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ExampleTabBar extends StatefulWidget {
ExampleTabBar({Key key}) : super(key: key);
ExampleTabBar({Key? key}) : super(key: key);
@override
_ExampleTabBarState createState() => _ExampleTabBarState();
@ -13,10 +13,10 @@ class ExampleTabBar extends StatefulWidget {
class _ExampleTabBarState extends State<ExampleTabBar>
with TickerProviderStateMixin {
TabController _tabController1;
TabController _tabController2;
TabController _tabController3;
TabController _tabController4;
TabController? _tabController1;
TabController? _tabController2;
TabController? _tabController3;
TabController? _tabController4;
@override
void initState() {
super.initState();
@ -58,23 +58,23 @@ class _ExampleTabBarState extends State<ExampleTabBar>
// BEGIN tabBar
ASTabBar(
items: ['全部', 'Part1', 'Part2'],
controller: _tabController1,
controller: _tabController1!,
),
ASTabBar(
items: List.generate(5, (index) => 'Tab $index'),
controller: _tabController2,
controller: _tabController2!,
),
ASTabBar(
isScrollable: true,
items: List.generate(10, (index) => 'Tab $index'),
controller: _tabController3,
controller: _tabController3!,
),
ASTabBar.tag(
isScrollable: true,
tabItems: List.generate(10, (index) => 'Tab $index')
.map((e) => ASTabBarItem(title: e, tag: e))
.toList(),
controller: _tabController4,
controller: _tabController4!,
),
// END

@ -6,7 +6,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class ExampleTag extends StatefulWidget {
ExampleTag({Key key}) : super(key: key);
ExampleTag({Key? key}) : super(key: key);
@override
_ExampaleTagState createState() => _ExampaleTagState();

@ -2,14 +2,14 @@ import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter/material.dart';
class ExampleTextFiled extends StatefulWidget {
ExampleTextFiled({Key key}) : super(key: key);
ExampleTextFiled({Key? key}) : super(key: key);
@override
_ExampleTextFiledState createState() => _ExampleTextFiledState();
}
class _ExampleTextFiledState extends State<ExampleTextFiled> {
TextEditingController _controller;
TextEditingController? _controller;
@override
Widget build(BuildContext context) {
return ASScaffold(

@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import 'package:velocity_x/velocity_x.dart';
class ExampleToast extends StatelessWidget {
const ExampleToast({Key key}) : super(key: key);
const ExampleToast({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {

@ -10,13 +10,6 @@ packages:
url: "https://git.oa00.com/flutter_pub/animated_collection.git"
source: git
version: "0.0.1"
animator:
dependency: transitive
description:
name: animator
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0"
ansu_ui:
dependency: "direct main"
description:
@ -28,86 +21,93 @@ packages:
dependency: "direct main"
description:
name: args
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.2.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.8.2"
auto_size_text_pk:
dependency: transitive
description:
name: auto_size_text_pk
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
bot_toast:
dependency: transitive
description:
name: bot_toast
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.1"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.3.3"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
cross_file:
dependency: transitive
description:
name: cross_file
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.1+4"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
version: "1.0.3"
expandable:
dependency: transitive
description:
name: expandable
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.1"
file:
dependency: transitive
description:
name: file
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.0"
version: "6.1.2"
flutter:
dependency: "direct main"
description: flutter
@ -117,7 +117,7 @@ packages:
dependency: transitive
description:
name: flutter_easyrefresh
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
flutter_localizations:
@ -129,16 +129,16 @@ packages:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.2"
flutter_screenutil:
dependency: transitive
description:
name: flutter_screenutil
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
version: "5.0.0+2"
flutter_web_plugins:
dependency: transitive
description: flutter
@ -148,107 +148,107 @@ packages:
dependency: "direct main"
description:
name: get
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.4"
version: "4.3.8"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
grinder:
dependency: "direct main"
description:
name: grinder
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.1"
version: "0.13.3"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
image_picker:
dependency: transitive
description:
name: image_picker
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.4"
version: "0.7.5+4"
image_picker_for_web:
dependency: transitive
description:
name: image_picker_for_web
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.3"
image_picker_platform_interface:
dependency: transitive
description:
name: image_picker_platform_interface
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.3.0"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
js:
dependency: transitive
description:
name: js
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
lpinyin:
dependency: transitive
description:
name: lpinyin
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
version: "1.11.1"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.1"
sky_engine:
dependency: transitive
description: flutter
@ -258,58 +258,51 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
states_rebuilder:
dependency: transitive
description:
name: states_rebuilder
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.0+1"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
velocity_x:
dependency: transitive
description:
name: velocity_x
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
version: "3.3.0"
vxstate:
dependency: transitive
description:
name: vxstate
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=2.0.0"

@ -4,7 +4,7 @@ publish_to: "none"
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'
dependencies:
flutter:
@ -17,7 +17,7 @@ dependencies:
cupertino_icons: ^1.0.0
ansu_ui:
path: ../
get:
get: ^4.1.3
grinder:
args:

@ -25,7 +25,7 @@ void main(List<String> arguments) {
writeSegments(
sourceDirectoryPath: path.join(Directory.current.path, 'lib'),
targetFilePath: argResults['target'] as String,
targetFilePath: argResults['target'] as String?,
isDryRun: argResults['dry-run'] as bool,
);
}

@ -76,15 +76,15 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
'bool',
];
String _src;
StringScanner _scanner;
String? _src;
late StringScanner _scanner;
List<_HighlightSpan> _spans;
late List<_HighlightSpan> _spans;
@override
List<CodeSpan> format(String src) {
List<CodeSpan> format(String? src) {
_src = src;
_scanner = StringScanner(_src);
_scanner = StringScanner(_src!);
if (_generateSpans()) {
// Successfully parsed the code
@ -93,19 +93,19 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
for (final span in _spans) {
if (currentPosition != span.start) {
formattedText
.add(CodeSpan(text: _src.substring(currentPosition, span.start)));
formattedText.add(
CodeSpan(text: _src!.substring(currentPosition, span.start)));
}
formattedText
.add(CodeSpan(type: span.type, text: span.textForSpan(_src)));
.add(CodeSpan(type: span.type, text: span.textForSpan(_src!)));
currentPosition = span.end;
}
if (currentPosition != _src.length) {
formattedText
.add(CodeSpan(text: _src.substring(currentPosition, _src.length)));
if (currentPosition != _src!.length) {
formattedText.add(
CodeSpan(text: _src!.substring(currentPosition, _src!.length)));
}
return formattedText;
@ -126,23 +126,23 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
if (_scanner.scan(RegExp(r'/\*(.|\n)*\*/'))) {
_spans.add(_HighlightSpan(
_HighlightType.comment,
_scanner.lastMatch.start,
_scanner.lastMatch.end,
_scanner.lastMatch!.start,
_scanner.lastMatch!.end,
));
continue;
}
// Line comments
if (_scanner.scan('//')) {
final startComment = _scanner.lastMatch.start;
final startComment = _scanner.lastMatch!.start;
var eof = false;
int endComment;
if (_scanner.scan(RegExp(r'.*\n'))) {
endComment = _scanner.lastMatch.end - 1;
endComment = _scanner.lastMatch!.end - 1;
} else {
eof = true;
endComment = _src.length;
endComment = _src!.length;
}
_spans.add(_HighlightSpan(
@ -162,8 +162,8 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
if (_scanner.scan(RegExp(r'r".*"'))) {
_spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end,
_scanner.lastMatch!.start,
_scanner.lastMatch!.end,
));
continue;
}
@ -172,8 +172,8 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
if (_scanner.scan(RegExp(r"r'.*'"))) {
_spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end,
_scanner.lastMatch!.start,
_scanner.lastMatch!.end,
));
continue;
}
@ -182,8 +182,8 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
if (_scanner.scan(RegExp(r'"""(?:[^"\\]|\\(.|\n))*"""'))) {
_spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end,
_scanner.lastMatch!.start,
_scanner.lastMatch!.end,
));
continue;
}
@ -192,8 +192,8 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
if (_scanner.scan(RegExp(r"'''(?:[^'\\]|\\(.|\n))*'''"))) {
_spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end,
_scanner.lastMatch!.start,
_scanner.lastMatch!.end,
));
continue;
}
@ -202,8 +202,8 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
if (_scanner.scan(RegExp(r'"(?:[^"\\]|\\.)*"'))) {
_spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end,
_scanner.lastMatch!.start,
_scanner.lastMatch!.end,
));
continue;
}
@ -212,8 +212,8 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
if (_scanner.scan(RegExp(r"'(?:[^'\\]|\\.)*'"))) {
_spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end,
_scanner.lastMatch!.start,
_scanner.lastMatch!.end,
));
continue;
}
@ -222,8 +222,8 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
if (_scanner.scan(RegExp(r'\d+\.\d+'))) {
_spans.add(_HighlightSpan(
_HighlightType.number,
_scanner.lastMatch.start,
_scanner.lastMatch.end,
_scanner.lastMatch!.start,
_scanner.lastMatch!.end,
));
continue;
}
@ -231,7 +231,7 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
// Integer
if (_scanner.scan(RegExp(r'\d+'))) {
_spans.add(_HighlightSpan(_HighlightType.number,
_scanner.lastMatch.start, _scanner.lastMatch.end));
_scanner.lastMatch!.start, _scanner.lastMatch!.end));
continue;
}
@ -239,8 +239,8 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
if (_scanner.scan(RegExp(r'[\[\]{}().!=<>&\|\?\+\-\*/%\^~;:,]'))) {
_spans.add(_HighlightSpan(
_HighlightType.punctuation,
_scanner.lastMatch.start,
_scanner.lastMatch.end,
_scanner.lastMatch!.start,
_scanner.lastMatch!.end,
));
continue;
}
@ -249,17 +249,17 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
if (_scanner.scan(RegExp(r'@\w+'))) {
_spans.add(_HighlightSpan(
_HighlightType.keyword,
_scanner.lastMatch.start,
_scanner.lastMatch.end,
_scanner.lastMatch!.start,
_scanner.lastMatch!.end,
));
continue;
}
// Words
if (_scanner.scan(RegExp(r'\w+'))) {
_HighlightType type;
_HighlightType? type;
var word = _scanner.lastMatch[0];
var word = _scanner.lastMatch![0]!;
if (word.startsWith('_')) {
word = word.substring(1);
}
@ -279,8 +279,8 @@ class DartSyntaxPrehighlighter extends SyntaxPrehighlighter {
if (type != null) {
_spans.add(_HighlightSpan(
type,
_scanner.lastMatch.start,
_scanner.lastMatch.end,
_scanner.lastMatch!.start,
_scanner.lastMatch!.end,
));
}
}
@ -346,13 +346,13 @@ class CodeSpan {
CodeSpan({this.type = _HighlightType.base, this.text});
final _HighlightType type;
final String text;
final String? text;
@override
String toString() {
return 'TextSpan('
'style: codeStyle.${_styleNameOf(type)}, '
"text: '${_escape(text)}'"
"text: '${_escape(text!)}'"
')';
}
}
@ -376,7 +376,6 @@ String _styleNameOf(_HighlightType type) {
case _HighlightType.base:
return 'baseStyle';
}
return '';
}
String _escape(String text) {
@ -409,4 +408,4 @@ String _encode(int charCode) {
String _encodeAndPad(int charCode) {
final encoded = _encode(charCode);
return '0' * (4 - encoded.length) + encoded;
}
}

@ -4,6 +4,7 @@
import 'dart:convert';
import 'dart:io';
import 'prehighlighter.dart';
const _globalPrologue =
@ -30,7 +31,7 @@ enum _FileReadStatus {
/// Returns the new status of the scanner whose previous status was
/// [oldStatus], after scanning the line [line].
_FileReadStatus _updatedStatus(_FileReadStatus oldStatus, String line) {
_FileReadStatus? _updatedStatus(_FileReadStatus? oldStatus, String line) {
_FileReadStatus lineStatus;
if (line.trim().startsWith('//')) {
lineStatus = _FileReadStatus.comments;
@ -40,7 +41,7 @@ _FileReadStatus _updatedStatus(_FileReadStatus oldStatus, String line) {
lineStatus = _FileReadStatus.finished;
}
_FileReadStatus newStatus;
_FileReadStatus? newStatus;
switch (oldStatus) {
case _FileReadStatus.comments:
newStatus =
@ -56,6 +57,8 @@ _FileReadStatus _updatedStatus(_FileReadStatus oldStatus, String line) {
case _FileReadStatus.finished:
newStatus = oldStatus;
break;
default:
newStatus = oldStatus;
}
return newStatus;
}
@ -77,7 +80,7 @@ Map<String, String> _createSegments(String sourceDirectoryPath) {
final content = file.readAsStringSync();
final lines = const LineSplitter().convert(content);
var status = _FileReadStatus.comments;
_FileReadStatus? status = _FileReadStatus.comments;
final prologue = StringBuffer();
@ -135,7 +138,7 @@ Map<String, String> _createSegments(String sourceDirectoryPath) {
// Simple line.
for (final name in activeSubsegments) {
subsegments[name].writeln(line);
subsegments[name]!.writeln(line);
}
}
}
@ -146,7 +149,7 @@ Map<String, String> _createSegments(String sourceDirectoryPath) {
}
var segments = <String, List<TaggedString>>{};
var segmentPrologues = <String, String>{};
var segmentPrologues = <String, String?>{};
// Sometimes a code segment is made up of subsegments. They are marked by
// names with a "#" symbol in it, such as "bottomSheetDemoModal#1" and
@ -168,7 +171,7 @@ Map<String, String> _createSegments(String sourceDirectoryPath) {
if (!segments.containsKey(name)) {
segments[name] = [];
}
segments[name].add(
segments[name]!.add(
TaggedString(
text: value.toString(),
order: order,
@ -179,7 +182,7 @@ Map<String, String> _createSegments(String sourceDirectoryPath) {
});
segments.forEach((key, value) {
value.sort((ts1, ts2) => (ts1.order - ts2.order).sign.round());
value.sort((ts1, ts2) => (ts1.order! - ts2.order!).sign.round());
});
var answer = <String, String>{};
@ -187,11 +190,11 @@ Map<String, String> _createSegments(String sourceDirectoryPath) {
for (final name in segments.keys) {
final buffer = StringBuffer();
buffer.write(segmentPrologues[name].trim());
buffer.write(segmentPrologues[name]!.trim());
buffer.write('\n\n');
for (final ts in segments[name]) {
buffer.write(ts.text.trim());
for (final ts in segments[name]!) {
buffer.write(ts.text!.trim());
buffer.write('\n\n');
}
@ -208,8 +211,8 @@ Map<String, String> _createSegments(String sourceDirectoryPath) {
class TaggedString {
TaggedString({this.text, this.order});
final String text;
final double order;
final String? text;
final double? order;
}
void _formatSegments(Map<String, String> segments, IOSink output) {
@ -254,13 +257,15 @@ void _formatSegments(Map<String, String> segments, IOSink output) {
///
/// The target file is overwritten.
void writeSegments(
{String sourceDirectoryPath, String targetFilePath, bool isDryRun}) {
{required String sourceDirectoryPath,
String? targetFilePath,
required bool isDryRun}) {
final segments = _createSegments(sourceDirectoryPath);
final output = isDryRun ? stdout : File(targetFilePath).openWrite();
final output = isDryRun ? stdout : File(targetFilePath!).openWrite();
_formatSegments(segments, output);
}
class PreformatterException implements Exception {
PreformatterException(this.cause);
String cause;
}
}

@ -63,7 +63,7 @@ Future<void> _runProcess(String executable, List<String> arguments) async {
// Function to make sure we capture all of the stdout.
// Reference: https://github.com/dart-lang/sdk/issues/31666
Future<String> _startProcess(String executable,
{List<String> arguments = const [], String input}) async {
{List<String> arguments = const [], String? input}) async {
final output = <int>[];
final completer = Completer<int>();
final process = await Process.start(executable, arguments);

@ -10,88 +10,81 @@ packages:
url: "https://git.oa00.com/flutter_pub/animated_collection.git"
source: git
version: "0.0.1"
animator:
dependency: transitive
description:
name: animator
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
auto_size_text_pk:
dependency: transitive
description:
name: auto_size_text_pk
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
bot_toast:
dependency: "direct main"
description:
name: bot_toast
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
cross_file:
dependency: transitive
description:
name: cross_file
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.1+4"
expandable:
dependency: "direct main"
description:
name: expandable
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.1"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
flutter:
@ -103,21 +96,21 @@ packages:
dependency: "direct main"
description:
name: flutter_easyrefresh
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
flutter_screenutil:
dependency: "direct main"
description:
name: flutter_screenutil
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0+2"
flutter_test:
@ -134,98 +127,98 @@ packages:
dependency: "direct main"
description:
name: get
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.4"
version: "4.3.8"
http:
dependency: transitive
description:
name: http
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
image_picker:
dependency: "direct main"
description:
name: image_picker
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.5+4"
image_picker_for_web:
dependency: transitive
description:
name: image_picker_for_web
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.3"
image_picker_platform_interface:
dependency: transitive
description:
name: image_picker_platform_interface
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "2.3.0"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
js:
dependency: transitive
description:
name: js
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
lpinyin:
dependency: "direct main"
description:
name: lpinyin
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
sky_engine:
@ -237,77 +230,70 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
states_rebuilder:
dependency: transitive
description:
name: states_rebuilder
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.3.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
velocity_x:
dependency: "direct main"
description:
name: velocity_x
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
version: "3.3.0"
vxstate:
dependency: transitive
description:
name: vxstate
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
sdks:

@ -16,7 +16,7 @@ dependencies:
lpinyin: ^2.0.1
image_picker: ^0.7.2
bot_toast: ^4.0.0+1
velocity_x: ^2.6.1
velocity_x: ^3.3.0
expandable: ^5.0.1
animated_collection:
git:

Loading…
Cancel
Save