Skip to content

Commit

Permalink
feat:代码格式化
Browse files Browse the repository at this point in the history
  • Loading branch information
Tecode committed Nov 4, 2023
1 parent 96a0e53 commit f45fcc7
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion lib/containers/chat_list.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:io';

import 'package:dynamic_theme/helpers/colors.dart';
import 'package:dynamic_theme/helpers/textThemeStyle.dart';
import 'package:dynamic_theme/helpers/text_theme_style.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/containers/entrance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class _EntranceState extends State<Entrance> {
children: <Widget>[
const Home(),
const Discovery(),
Order(),
const Order(),
Mine(
options: widget.options ?? Options(),
handleOptionsChanged: widget.handleOptionsChanged,
Expand Down
2 changes: 1 addition & 1 deletion lib/containers/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class _HomeState extends State<Home> {
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index == 0) return SizedBox(height: 15.0);
if (index == 0) return const SizedBox(height: 15.0);
return AvatarWrapBox(
key: Key('item_$index'),
onTap: () => Navigator.of(context).pushNamed(ChatList.routeName),
Expand Down
12 changes: 7 additions & 5 deletions lib/containers/mine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ class Mine extends StatefulWidget {
final Options? options;
final Function? handleOptionsChanged;
const Mine({
Key? key,
this.handleOptionsChanged,
this.options,
});
}) : super(key: key);

static Map<String, String> languageMap = {'zh': '汉语', 'en': 'English'};

Expand All @@ -24,7 +25,7 @@ class _MineState extends State<Mine> {
Navigator.pushNamed(
context,
'/newView5',
arguments: NewView(
arguments: const NewView(
content: '网络搜索结果汉语- 维基百科,自由的百科全书',
),
);
Expand All @@ -51,7 +52,7 @@ class _MineState extends State<Mine> {
'Flutter: Dynamic Theming | Change Theme At Runtime',
style: Theme.of(context).textTheme.bodyText2,
),
ButtonColor(),
const ButtonColor(),
TextButton(
onPressed: () => _launchRouter(context),
child: Text(
Expand Down Expand Up @@ -83,12 +84,12 @@ class _MineState extends State<Mine> {
onPressed: () {
if (language == 'zh') {
widget.handleOptionsChanged!(
widget.options!.copyWith(locale: Locale('en')),
widget.options!.copyWith(locale: const Locale('en')),
);
return;
}
widget.handleOptionsChanged!(
widget.options!.copyWith(locale: Locale('zh')),
widget.options!.copyWith(locale: const Locale('zh')),
);
},
child: Text(
Expand All @@ -110,6 +111,7 @@ class _MineState extends State<Mine> {
}

class ButtonColor extends StatefulWidget {
const ButtonColor({Key? key}) : super(key: key);
@override
_ButtonColorState createState() => _ButtonColorState();
}
Expand Down
8 changes: 4 additions & 4 deletions lib/containers/new_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ class _NewViewState extends State<NewView> with RouteAware {
@override
void didPopNext() {
// Covering route was popped off the navigator.
print('返回NewView');
debugPrint('返回NewView');
}

@override
void didPush() {
// Route was pushed onto navigator and is now topmost route.
print('进入NewView');
debugPrint('进入NewView');
}

@override
Expand All @@ -48,7 +48,7 @@ class _NewViewState extends State<NewView> with RouteAware {

return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
padding: EdgeInsetsDirectional.only(),
padding: const EdgeInsetsDirectional.only(),
transitionBetweenRoutes: Platform.isIOS,
middle: Text(
'NewList-${param.content}',
Expand Down Expand Up @@ -81,7 +81,7 @@ class _NewViewState extends State<NewView> with RouteAware {
splashColor: Colors.transparent,
onTap: () => Navigator.of(context).pushNamed(
Detail.routeName,
arguments: Detail(value: 'NewView参数'),
arguments: const Detail(value: 'NewView参数'),
),
child: SizedBox(
height: 44.0,
Expand Down
2 changes: 1 addition & 1 deletion lib/containers/order.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class _OrderState extends State<Order> {
}

class OrderCard extends StatelessWidget {
const OrderCard();
const OrderCard({Key? key}):super(key: key);
@override
Widget build(BuildContext context) {
return Container(
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/widgets/common/dialog_box.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:dynamic_theme/helpers/colors.dart';
import 'package:dynamic_theme/helpers/textThemeStyle.dart';
import 'package:dynamic_theme/helpers/text_theme_style.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -48,7 +48,7 @@ class DialogBox extends StatelessWidget {

class BottomButton extends StatelessWidget {
final bool cancelButton;
const BottomButton({this.cancelButton = false});
const BottomButton({Key? key, this.cancelButton = false}) : super(key: key);

Widget _buttonWidget(BuildContext context) {
if (cancelButton) {
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/common/refresh_footer.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:math';

import 'package:dynamic_theme/helpers/colors.dart';
import 'package:dynamic_theme/helpers/textThemeStyle.dart';
import 'package:dynamic_theme/helpers/text_theme_style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';

Expand Down Expand Up @@ -97,7 +97,7 @@ class RefreshFooter extends Footer {
loadIndicatorExtent: loadIndicatorExtent,
axisDirection: axisDirection,
float: float,
completeDuration: completeDuration ?? Duration(milliseconds: 300),
completeDuration: completeDuration ?? const Duration(milliseconds: 300),
enableInfiniteLoad: enableInfiniteLoad,
success: success,
noMore: noMore,
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/common/refresh_header.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:async';
import 'dart:math';
import 'package:dynamic_theme/helpers/colors.dart';
import 'package:dynamic_theme/helpers/textThemeStyle.dart';
import 'package:dynamic_theme/helpers/text_theme_style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';

Expand Down
7 changes: 3 additions & 4 deletions lib/widgets/entrance/navigation_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ class NavigationBar extends StatelessWidget {
final Function onChange;
const NavigationBar({
required this.onChange,
Key? key,
this.activeKey = 'HOME',
});
}) : super(key: key);

@override
Widget build(BuildContext context) => Container(
Expand Down Expand Up @@ -58,9 +59,7 @@ class NavigationBar extends StatelessWidget {
: ColorTheme.of(context).cubeColor,
),
),
SizedBox(
height: 4.0,
)
const SizedBox(height: 4.0)
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(App());
await tester.pumpWidget(const App());

// Tap the '+' icon and trigger a frame.
await tester.tap(find.byType(TextButton));
Expand Down

0 comments on commit f45fcc7

Please sign in to comment.