Skip to content

Commit 78eccd8

Browse files
committed
优化项目结构
1 parent b079f2b commit 78eccd8

File tree

1,155 files changed

+277
-377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,155 files changed

+277
-377
lines changed

analysis_options.yaml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,13 @@
1010
include: package:flutter_lints/flutter.yaml
1111

1212
linter:
13-
# The lint rules applied to this project can be customized in the
14-
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15-
# included above or to enable additional rules. A list of all available lints
16-
# and their documentation is published at
17-
# https://dart-lang.github.io/linter/lints/index.html.
18-
#
19-
# Instead of disabling a lint rule for the entire project in the
20-
# section below, it can also be suppressed for a single line of code
21-
# or a specific dart file by using the `// ignore: name_of_lint` and
22-
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23-
# producing the lint.
2413
rules:
2514
avoid_print: false # Uncomment to disable the `avoid_print` rule
2615
file_names: false
27-
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
2816

29-
# Additional information about this file can be found at
30-
# https://dart.dev/guides/language/analysis-options
17+
analyzer:
18+
exclude:
19+
- modules/widget_system/widgets/**
20+
21+
22+

lib/main.dart

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
import 'package:app/app.dart';
2-
import 'package:fx_boot_starter/fx_boot_starter.dart';
3-
import 'package:flutter/material.dart';
1+
import 'dart:async';
2+
import 'stater/boot_start.dart';
43

5-
import 'app/bloc_wrapper.dart';
6-
import 'app/flutter_unit.dart';
7-
import 'app_stater/impl/app_start_action.dart';
8-
import 'app_stater/impl/start_repository.dart';
9-
10-
void main() {
11-
runApp(
12-
AppStartScope<AppConfigState>(
13-
repository: const AppStartRepositoryImpl(),
14-
appStartAction: const AppStartActionImpl(),
15-
child: BlocWrapper(child: FlutterUnit3()),
16-
),
17-
);
4+
void main(List<String> args) {
5+
runZonedGuarded(() => bootStart(args), _globalErrorHandler);
186
}
7+
8+
void _globalErrorHandler(Object exception, StackTrace trace) async{
9+
print(trace);
10+
// 可自定义处理全局异常
11+
}

lib/stater/boot_start.dart

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import 'package:app/app.dart';
2+
import 'package:flutter/material.dart';
3+
import 'package:fx_boot_starter/fx_boot_starter.dart';
4+
5+
import '../structure/wrapper/bloc_wrapper.dart';
6+
import '../structure/flutter_unit.dart';
7+
import 'logic/app_start_action.dart';
8+
import 'logic/app_start_repository.dart';
9+
10+
export 'view/splash/Flutter_unit_splash.dart';
11+
export 'view/error/app_start_error.dart';
12+
13+
void bootStart(List<String> args) {
14+
runApp(
15+
AppStartScope<AppConfigState>(
16+
repository: const AppStartRepositoryImpl(),
17+
appStartAction: const AppStartActionImpl(),
18+
child: BlocWrapper(child: FlutterUnit3()),
19+
),
20+
);
21+
}
File renamed without changes.

lib/app_stater/view/splash/standard_unit_splash.dart renamed to lib/stater/view/splash/Flutter_unit_splash.dart

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'package:flutter/services.dart';
66

77
import 'dart:ui' as ui;
88

9-
109
import 'flutter_unit_text.dart';
1110

1211
/// create by 张风捷特烈 on 2020-03-07
@@ -42,7 +41,7 @@ class _SplashBody extends StatelessWidget {
4241
return Column(
4342
children: [
4443
const SplashTopBar(
45-
leading: Text('Flutter Unit',style: titleStyle),
44+
leading: Text('Flutter Unit', style: titleStyle),
4645
logo: CircleAvatar(
4746
backgroundImage: AssetImage('assets/images/icon_head.webp'),
4847
radius: 14,
@@ -102,11 +101,7 @@ class ColorfulText extends StatelessWidget {
102101
);
103102
return Text(
104103
"U",
105-
style: TextStyle(
106-
fontSize: 26,
107-
height: 1,
108-
fontWeight: FontWeight.bold,
109-
foreground: paint),
104+
style: TextStyle(fontSize: 26, height: 1, fontWeight: FontWeight.bold, foreground: paint),
110105
);
111106
}
112107
}
@@ -115,37 +110,40 @@ class SplashTopBar extends StatelessWidget {
115110
final Widget? leading;
116111
final Widget? logo;
117112

118-
const SplashTopBar({super.key, this.leading,this.logo});
113+
const SplashTopBar({super.key, this.leading, this.logo});
119114

120115
@override
121116
Widget build(BuildContext context) {
122-
if(!isDesk) return const SizedBox.shrink();
117+
if (!isDesk) return const SizedBox.shrink();
123118
return DragToMoveWrapper(
124119
child: Stack(
125120
children: [
126121
Container(
127122
alignment: Alignment.topLeft,
128-
padding: const EdgeInsets.symmetric(horizontal: 12.0,vertical: 8),
123+
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8),
129124
child: Row(
130125
children: [
131-
if (leading != null) Row(
132-
children: [
133-
if(logo!=null)logo!,
134-
const SizedBox(width: 8,),
135-
leading!,
136-
],
137-
),
126+
if (leading != null)
127+
Row(
128+
children: [
129+
if (logo != null) logo!,
130+
const SizedBox(
131+
width: 8,
132+
),
133+
leading!,
134+
],
135+
),
138136
const Spacer(),
139137
const SizedBox(
140138
width: 20,
141139
),
142140
],
143141
),
144142
),
145-
Positioned(
146-
147-
right: 0,
148-
child: const WindowButtons())
143+
const Positioned(
144+
right: 0,
145+
child: WindowButtons(),
146+
)
149147
],
150148
),
151149
);

lib/app/flutter_unit.dart renamed to lib/structure/flutter_unit.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import 'package:algorithm/algorithm.dart';
22
import 'package:app/app.dart';
33
import 'package:flutter/material.dart';
44
import 'package:flutter_bloc/flutter_bloc.dart';
5-
import 'package:flutter_localizations/flutter_localizations.dart';
6-
import 'package:flutter_unit/navigation/routers/app_route.dart';
5+
76
import 'package:go_router/go_router.dart';
87
import 'package:l10n/l10n.dart';
98
import 'package:tolyui/tolyui.dart';
109

10+
import 'navigation/router/app_route.dart';
11+
1112
/// create by 张风捷特烈 on 2020/4/28
1213
/// contact me by email [email protected]
1314
/// 说明: 主程序

lib/navigation/routers/app_route.dart renamed to lib/structure/navigation/router/app_route.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import 'package:app/app.dart';
2+
import 'package:flutter_unit/stater/boot_start.dart';
23
import 'package:fx_boot_starter/fx_boot_starter.dart';
34
import 'package:flutter/material.dart';
45
import 'package:go_router/go_router.dart';
56

6-
import '../../app_stater/view/error/app_start_error.dart';
7-
import '../../app_stater/view/splash/standard_unit_splash.dart';
8-
97
import 'desk_route.dart';
108
import 'mobile_route.dart';
119

0 commit comments

Comments
 (0)