Skip to content

Commit e5a9f5b

Browse files
committed
improve loading screen
1 parent 791d71d commit e5a9f5b

File tree

6 files changed

+32
-71
lines changed

6 files changed

+32
-71
lines changed

.github/pull_request_template.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,3 @@
99

1010
#### Notes:
1111
[extra note or considerations]
12-
13-
@rs-gpt-review Describe the changes in this PR. Recommend improvements (including code improvements), possible memory leaks, and best practices.

.github/workflows/rs-gpt-review.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
11
import 'package:flutter/material.dart';
22

33
class LoadingScreen extends StatelessWidget {
4-
final bool isLoading;
54
final Color? color;
65

76
const LoadingScreen({
87
super.key,
9-
required this.isLoading,
108
this.color,
119
});
1210

1311
@override
1412
Widget build(BuildContext context) {
15-
return Positioned.fill(
16-
child: isLoading
17-
? Container(
18-
color: Colors.transparent,
19-
child: Center(
20-
child: SizedBox(
21-
width: 24,
22-
height: 24,
23-
child: CircularProgressIndicator(
24-
color: color,
25-
),
26-
),
27-
),
28-
)
29-
: const SizedBox.shrink(),
13+
return Container(
14+
color: Theme.of(context).colorScheme.primaryContainer.withAlpha(50),
15+
child: Center(
16+
child: SizedBox(
17+
width: 24,
18+
height: 24,
19+
child: CircularProgressIndicator(
20+
color: color,
21+
),
22+
),
23+
),
3024
);
3125
}
3226
}

app/lib/presentation/ui/pages/login/login_page.dart

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ class LoginPage extends StatelessWidget {
1818

1919
@override
2020
Widget build(BuildContext context) {
21-
return Stack(
22-
children: [
23-
Scaffold(
24-
appBar: AppBar(),
25-
backgroundColor: context.theme.colorScheme.surface,
26-
body: Padding(
21+
return Scaffold(
22+
body: Stack(
23+
children: [
24+
Padding(
2725
padding: EdgeInsets.all(spacing.m),
2826
child: Column(
2927
mainAxisAlignment: MainAxisAlignment.center,
3028
children: [
31-
const _Loading(),
3229
const AppThemeSwitch(),
3330
SizedBox(height: spacing.m),
3431
SizedBox(
@@ -50,8 +47,9 @@ class LoginPage extends StatelessWidget {
5047
],
5148
),
5249
),
53-
),
54-
],
50+
const _Loading(),
51+
],
52+
),
5553
);
5654
}
5755
}
@@ -63,8 +61,15 @@ class _Loading extends StatelessWidget {
6361
Widget build(BuildContext context) {
6462
return BlocBuilder<AuthCubit, Resource>(
6563
builder: (context, state) {
66-
return LoadingScreen(
67-
isLoading: state is RLoading,
64+
if (state is! RLoading) {
65+
return const SizedBox.shrink();
66+
}
67+
68+
return Container(
69+
color: Colors.black.withAlpha(50),
70+
width: double.maxFinite,
71+
height: double.maxFinite,
72+
child: const LoadingScreen(),
6873
);
6974
},
7075
);

app/melos.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ packages:
55
- modules/*
66

77
scripts:
8-
run:web:
9-
exec: cd app && flutter run -t lib/main.dart --dart-define-from-file=env/.dev -d chrome
10-
description: Run the app in development mode for web.
118
lint:all:
129
run: melos run analyze && melos run format
1310
description: Run all static analysis checks.

melos.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ packages:
55
- modules/*
66

77
scripts:
8+
run:web:
9+
description: Run the app in development mode for web.
10+
run: melos exec --scope="app" -- \
11+
flutter run -t lib/main.dart --dart-define-from-file=env/.dev -d chrome
812
lint:all:
913
run: melos run analyze && melos run format
1014
description: Run all static analysis checks.
@@ -38,4 +42,4 @@ scripts:
3842
description: Run `dart doctor` in selected or all packages. Includes prompt for packages.
3943
packageFilters:
4044
dirExists:
41-
- lib
45+
- lib

0 commit comments

Comments
 (0)