Skip to content

Commit bccd733

Browse files
authored
Merge pull request #220 from AmosHuKe/ci-code-analysis
CI: Action - Code Analysis
2 parents 8b71392 + 4dff5c5 commit bccd733

16 files changed

+105
-32
lines changed

.github/workflows/code-analysis.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Code Analysis
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
paths-ignore:
9+
- '**.md'
10+
pull_request:
11+
branches:
12+
- master
13+
paths-ignore:
14+
- '**.md'
15+
16+
jobs:
17+
code-analysis:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: subosito/flutter-action@v2
22+
with:
23+
channel: 'stable'
24+
- name: Prepare dependencies
25+
run: |
26+
flutter --version
27+
flutter pub get
28+
- name: Check Dart code formatting
29+
run: |
30+
dart format . -o none --set-exit-if-changed
31+
- name: Analyze Dart code
32+
run: |
33+
flutter analyze .
34+
- name: Generate dartdoc
35+
run: |
36+
dart pub global activate dartdoc
37+
dart pub global run dartdoc .
38+
test:
39+
needs: [code-analysis]
40+
runs-on: ubuntu-latest
41+
strategy:
42+
matrix:
43+
flutter-version: ['']
44+
steps:
45+
- uses: actions/checkout@v4
46+
- uses: subosito/flutter-action@v2
47+
with:
48+
channel: 'stable'
49+
flutter-version: ${{ matrix.flutter-version }}
50+
- name: Prepare dependencies
51+
run: |
52+
flutter --version
53+
flutter pub get
54+
- name: Test
55+
run: flutter test

example/lib/demo/issue181_overstep.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ class _TestingDialogState extends State<_TestingDialog>
8080
alignment: Alignment.bottomCenter,
8181
children: [
8282
// 这里,点击事件也可以传递到遮罩
83-
SizedBox(height: MediaQuery.of(context).size.height,width: MediaQuery.of(context).size.width),
83+
SizedBox(
84+
height: MediaQuery.of(context).size.height,
85+
width: MediaQuery.of(context).size.width,
86+
),
8487
Container(height: 300, color: Colors.blue),
8588
AnimatedBuilder(
8689
animation: animationController,

example/lib/demo/issue183_visibility.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,4 @@ class Page1 extends StatelessWidget {
141141
],
142142
);
143143
}
144-
}
144+
}

example/lib/demo/issue188_quick_close.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class MyApp extends StatelessWidget {
2222
);
2323
}
2424

25-
void _show() async{
25+
void _show() async {
2626
SmartDialog.show(
2727
builder: (_) {
2828
return Container(

example/lib/demo/issue190_release.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MyApp extends StatelessWidget {
3333
);
3434
},
3535
animationType: SmartAnimationType.centerFade_otherSlide,
36-
backDismiss: true,
36+
backType: SmartBackType.normal,
3737
keepSingle: true,
3838
debounce: true,
3939
);

example/lib/demo/issue191_toast.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class MyApp extends StatelessWidget {
4242
},
4343
displayTime: const Duration(milliseconds: 2000),
4444
keepSingle: true,
45-
backDismiss: false,
45+
backType: SmartBackType.block,
4646
);
4747

4848
// SmartDialog.showLoading();

example/lib/demo/issue200_loading.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ class MyApp extends StatelessWidget {
1616
}
1717
}
1818

19-
2019
/// @Describe: 测试
2120
///
2221
/// @Author: LiWeNHuI
@@ -63,7 +62,7 @@ class _DemoPageState extends State<DemoPage> {
6362
maskColor: Colors.transparent,
6463
clickMaskDismiss: false,
6564
displayTime: const Duration(milliseconds: 1500),
66-
backDismiss: false,
65+
backType: SmartBackType.block,
6766
);
6867
}
6968

@@ -74,7 +73,7 @@ class _DemoPageState extends State<DemoPage> {
7473
builder: (BuildContext ctx) {
7574
return Dialog(
7675
insetPadding:
77-
const EdgeInsets.symmetric(vertical: 24, horizontal: 32),
76+
const EdgeInsets.symmetric(vertical: 24, horizontal: 32),
7877
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
7978
child: PopScope(
8079
canPop: false,
@@ -113,7 +112,7 @@ class _DemoPageState extends State<DemoPage> {
113112
animationBuilder: (_, Widget child, ___) =>
114113
TestAnimation(animationParam: ___, child: child),
115114
displayTime: const Duration(milliseconds: 2300),
116-
backDismiss: false,
115+
backType: SmartBackType.block,
117116
keepSingle: true,
118117
);
119118
},
@@ -165,12 +164,12 @@ class _TestAnimationState extends State<TestAnimation>
165164
duration: const Duration(milliseconds: 300),
166165
vsync: this,
167166
)..addListener(() {
168-
if (controller.value > .3 && !isStart) {
169-
isStart = true;
167+
if (controller.value > .3 && !isStart) {
168+
isStart = true;
170169

171-
bodyController.forward();
172-
}
173-
});
170+
bodyController.forward();
171+
}
172+
});
174173

175174
bodyController = AnimationController(
176175
duration: const Duration(milliseconds: 8000),

example/lib/demo/issue205_dark_model.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ class MyApp extends StatelessWidget {
1818
useMaterial3: true,
1919
),
2020
darkTheme: ThemeData(
21-
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple, brightness: Brightness.dark),
21+
colorScheme: ColorScheme.fromSeed(
22+
seedColor: Colors.deepPurple,
23+
brightness: Brightness.dark,
24+
),
2225
brightness: Brightness.dark,
2326
useMaterial3: true,
2427
),
@@ -76,4 +79,4 @@ class _MyHomePageState extends State<MyHomePage> {
7679
), // This trailing comma makes auto-formatting nicer for build methods.
7780
);
7881
}
79-
}
82+
}

example/lib/demo/issue209.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class MyApp extends StatelessWidget {
2323
}
2424

2525
void _show() async {
26-
print("before:${DateTime.now().millisecondsSinceEpoch}");
26+
debugPrint("before:${DateTime.now().millisecondsSinceEpoch}");
2727
var result = await SmartDialog.show<bool>(
2828
tag: 'tag',
29-
backDismiss: false,
29+
backType: SmartBackType.block,
3030
clickMaskDismiss: false,
3131
builder: (_) {
3232
return ElevatedButton(
@@ -37,12 +37,12 @@ class MyApp extends StatelessWidget {
3737
);
3838
},
3939
onDismiss: () {
40-
print("onDismiss:${DateTime.now().millisecondsSinceEpoch}");
40+
debugPrint("onDismiss:${DateTime.now().millisecondsSinceEpoch}");
4141
// showLoading()放在这里能正常显示
4242
// SmartDialog.showLoading();
4343
});
4444

45-
print("aftermiss:${DateTime.now().millisecondsSinceEpoch}");
45+
debugPrint("aftermiss:${DateTime.now().millisecondsSinceEpoch}");
4646
if (result == true) {
4747
// showLoading() 放在这里需要加一点延时才能显示Loading
4848
// await Future.delayed(const Duration(seconds: 1));

example/lib/main.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ class MyApp extends StatelessWidget {
1515
navigatorObservers: [FlutterSmartDialog.observer],
1616
builder: FlutterSmartDialog.init(),
1717
darkTheme: ThemeData(
18-
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple, brightness: Brightness.dark),
18+
colorScheme: ColorScheme.fromSeed(
19+
seedColor: Colors.deepPurple,
20+
brightness: Brightness.dark,
21+
),
1922
brightness: Brightness.dark,
2023
useMaterial3: true,
2124
),

0 commit comments

Comments
 (0)