Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

[flutter]: config skip screen ui

appflowyb8dcc9414d69
diff --git a/app_flowy/lib/user/application/sign_in_bloc.dart b/app_flowy/lib/user/application/sign_in_bloc.dart
index 59139fb1ef..73bdbeb2ff 100644
--- a/app_flowy/lib/user/application/sign_in_bloc.dart
+++ b/app_flowy/lib/user/application/sign_in_bloc.dart
@@ -8,8 +8,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
part 'sign_in_bloc.freezed.dart';
class SignInBloc extends Bloc<SignInEvent, SignInState> {
- final IAuth authImpl;
- SignInBloc(this.authImpl) : super(SignInState.initial());
+ final IAuth authManager;
+ SignInBloc(this.authManager) : super(SignInState.initial());
@override
Stream<SignInState> mapEventToState(
@@ -33,7 +33,7 @@ class SignInBloc extends Bloc<SignInEvent, SignInState> {
Stream<SignInState> _performActionOnSignIn(SignInState state) async* {
yield state.copyWith(isSubmitting: true, emailError: none(), passwordError: none(), successOrFail: none());
- final result = await authImpl.signIn(state.email, state.password);
+ final result = await authManager.signIn(state.email, state.password);
yield result.fold(
(userProfile) => state.copyWith(isSubmitting: false, successOrFail: some(left(userProfile))),
(error) => stateFromCode(error),
diff --git a/app_flowy/lib/user/domain/i_auth.dart b/app_flowy/lib/user/domain/i_auth.dart
index d85d8ade44..4357491e27 100644
--- a/app_flowy/lib/user/domain/i_auth.dart
+++ b/app_flowy/lib/user/domain/i_auth.dart
@@ -3,10 +3,8 @@ import 'package:dartz/dartz.dart';
import 'package:flutter/material.dart';
abstract class IAuth {
- Future<Either<UserProfile, UserError>> signIn(
- String? email, String? password);
- Future<Either<UserProfile, UserError>> signUp(
- String? name, String? password, String? email);
+ Future<Either<UserProfile, UserError>> signIn(String? email, String? password);
+ Future<Either<UserProfile, UserError>> signUp(String? name, String? password, String? email);
Future<Either<Unit, UserError>> signOut();
}
diff --git a/app_flowy/lib/user/domain/i_splash.dart b/app_flowy/lib/user/domain/i_splash.dart
index c4bb8f2973..1488af8d04 100644
--- a/app_flowy/lib/user/domain/i_splash.dart
+++ b/app_flowy/lib/user/domain/i_splash.dart
@@ -17,7 +17,8 @@ abstract class ISplashUserWatch {
abstract class ISplashRoute {
void pushSignInScreen(BuildContext context);
+ void pushSkipLoginScreen(BuildContext context);
+
Future<void> pushWelcomeScreen(BuildContext context, UserProfile profile);
- void pushHomeScreen(
- BuildContext context, UserProfile profile, String workspaceId);
+ void pushHomeScreen(BuildContext context, UserProfile profile, String workspaceId);
}
diff --git a/app_flowy/lib/user/infrastructure/i_auth_impl.dart b/app_flowy/lib/user/infrastructure/i_auth_impl.dart
index 4d82c3c88f..5d60ffe387 100644
--- a/app_flowy/lib/user/infrastructure/i_auth_impl.dart
+++ b/app_flowy/lib/user/infrastructure/i_auth_impl.dart
@@ -15,14 +15,12 @@ class AuthImpl extends IAuth {
});
@override
- Future<Either<UserProfile, UserError>> signIn(
- String? email, String? password) {
+ Future<Either<UserProfile, UserError>> signIn(String? email, String? password) {
return repo.signIn(email: email, password: password);
}
@override
- Future<Either<UserProfile, UserError>> signUp(
- String? name, String? password, String? email) {
+ Future<Either<UserProfile, UserError>> signUp(String? name, String? password, String? email) {
return repo.signUp(name: name, password: password, email: email);
}
diff --git a/app_flowy/lib/user/infrastructure/i_splash_impl.dart b/app_flowy/lib/user/infrastructure/i_splash_impl.dart
index 16f498c2e3..4c6e93076e 100644
--- a/app_flowy/lib/user/infrastructure/i_splash_impl.dart
+++ b/app_flowy/lib/user/infrastructure/i_splash_impl.dart
@@ -58,7 +58,20 @@ class SplashRoute implements ISplashRoute {
void pushSignInScreen(BuildContext context) {
Navigator.push(
context,
- PageRoutes.fade(() => SkipLogInScreen(router: getIt<IAuthRouter>()), RouteDurations.slow.inMilliseconds * .001),
+ PageRoutes.fade(() => SignInScreen(router: getIt<IAuthRouter>()), RouteDurations.slow.inMilliseconds * .001),
+ );
+ }
+
+ @override
+ void pushSkipLoginScreen(BuildContext context) {
+ Navigator.push(
+ context,
+ PageRoutes.fade(
+ () => SkipLogInScreen(
+ router: getIt<IAuthRouter>(),
+ authManager: getIt<IAuth>(),
+ ),
+ RouteDurations.slow.inMilliseconds * .001),
);
}
}
diff --git a/app_flowy/lib/user/presentation/sign_in_screen.dart b/app_flowy/lib/user/presentation/sign_in_screen.dart
index ff88a477ed..18c04130af 100644
--- a/app_flowy/lib/user/presentation/sign_in_screen.dart
+++ b/app_flowy/lib/user/presentation/sign_in_screen.dart
@@ -58,7 +58,7 @@ class SignInForm extends StatelessWidget {
alignment: Alignment.center,
child: AuthFormContainer(
children: [
- const AuthFormTitle(
+ const FlowyLogoTitle(
title: 'Login to Appflowy',
logoSize: Size(60, 60),
),
diff --git a/app_flowy/lib/user/presentation/sign_up_screen.dart b/app_flowy/lib/user/presentation/sign_up_screen.dart
index 0461abd695..e65e8daac3 100644
--- a/app_flowy/lib/user/presentation/sign_up_screen.dart
+++ b/app_flowy/lib/user/presentation/sign_up_screen.dart
@@ -53,7 +53,7 @@ class SignUpForm extends StatelessWidget {
alignment: Alignment.center,
child: AuthFormContainer(
children: [
- const AuthFormTitle(
+ const FlowyLogoTitle(
title: 'Sign Up to Appflowy',
logoSize: Size(60, 60),
),
diff --git a/app_flowy/lib/user/presentation/skip_log_in_screen.dart b/app_flowy/lib/user/presentation/skip_log_in_screen.dart
index e28c725d30..1525a4ae68 100644
--- a/app_flowy/lib/user/presentation/skip_log_in_screen.dart
+++ b/app_flowy/lib/user/presentation/skip_log_in_screen.dart
@@ -1,47 +1,22 @@
-// ignore_for_file: prefer_const_constructors
-
-import 'package:app_flowy/startup/startup.dart';
-import 'package:app_flowy/user/application/sign_in_bloc.dart';
import 'package:app_flowy/user/domain/i_auth.dart';
import 'package:app_flowy/user/presentation/widgets/background.dart';
import 'package:flowy_infra/size.dart';
import 'package:flowy_infra/theme.dart';
import 'package:flowy_infra_ui/widget/rounded_button.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
-import 'package:flowy_infra_ui/style_widget/snap_bar.dart';
-import 'package:flowy_sdk/protobuf/flowy-user/errors.pb.dart';
-import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'package:dartz/dartz.dart';
import 'package:url_launcher/url_launcher.dart';
class SkipLogInScreen extends StatelessWidget {
final IAuthRouter router;
- const SkipLogInScreen({Key? key, required this.router}) : super(key: key);
+ final IAuth authManager;
+ const SkipLogInScreen({Key? key, required this.router, required this.authManager}) : super(key: key);
@override
Widget build(BuildContext context) {
- return BlocProvider(
- create: (context) => getIt<SignInBloc>(),
- child: BlocListener<SignInBloc, SignInState>(
- listener: (context, state) {
- state.successOrFail.fold(
- () => null,
- (result) => _handleSuccessOrFail(result, context),
- );
- },
- child: Scaffold(
- body: SignInForm(router: router),
- ),
- ),
- );
- }
-
- void _handleSuccessOrFail(Either<UserProfile, UserError> result, BuildContext context) {
- result.fold(
- (user) => router.pushWelcomeScreen(context, user),
- (error) => showSnapBar(context, error.msg),
+ return Scaffold(
+ body: SignInForm(router: router),
);
}
}
@@ -57,45 +32,43 @@ class SignInForm extends StatelessWidget {
Widget build(BuildContext context) {
return Center(
child: SizedBox(
- width: 600,
+ width: 400,
height: 600,
- child: Expanded(
- child: Column(
- // ignore: prefer_const_literals_to_create_immutables
- children: [
- const AuthFormTitle(
- title: 'Welcome to AppFlowy',
- logoSize: Size(60, 60),
- ),
- const VSpace(80),
- const GoButton(),
- const VSpace(30),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- // ignore: prefer_const_constructors
- InkWell(
- child: Text(
- 'Star on Github',
- style: TextStyle(decoration: TextDecoration.underline, color: Colors.blue),
- ),
- onTap: () {
- _launchURL('https://github.com/AppFlowy-IO/appflowy');
- },
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ const FlowyLogoTitle(
+ title: 'Welcome to AppFlowy',
+ logoSize: Size.square(60),
+ ),
+ const VSpace(80),
+ GoButton(onPressed: _autoRegister),
+ const VSpace(30),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+ children: [
+ InkWell(
+ child: const Text(
+ 'Star on Github',
+ style: TextStyle(decoration: TextDecoration.underline, color: Colors.blue),
),
- HSpace(60),
- InkWell(
- child: Text(
- 'Subscribe to Newsletter',
- style: TextStyle(decoration: TextDecoration.underline, color: Colors.blue),
- ),
- onTap: () {
- _launchURL('https://www.appflowy.io/blog');
- }),
- ],
- )
- ],
- ),
+ onTap: () {
+ _launchURL('https://github.com/AppFlowy-IO/appflowy');
+ },
+ ),
+ const Spacer(),
+ InkWell(
+ child: const Text(
+ 'Subscribe to Newsletter',
+ style: TextStyle(decoration: TextDecoration.underline, color: Colors.blue),
+ ),
+ onTap: () {
+ _launchURL('https://www.appflowy.io/blog');
+ },
+ ),
+ ],
+ )
+ ],
),
),
);
@@ -108,11 +81,15 @@ class SignInForm extends StatelessWidget {
throw 'Could not launch $url';
}
}
+
+ void _autoRegister() {}
}
class GoButton extends StatelessWidget {
+ final VoidCallback onPressed;
const GoButton({
Key? key,
+ required this.onPressed,
}) : super(key: key);
@override
@@ -120,12 +97,10 @@ class GoButton extends StatelessWidget {
final theme = context.watch<AppTheme>();
return RoundedTextButton(
title: 'Let\'s Go',
- height: 60,
+ height: 50,
borderRadius: Corners.s10Border,
color: theme.main1,
- onPressed: () {
- //to do: direct to the workspace
- },
+ onPressed: onPressed,
);
}
}
diff --git a/app_flowy/lib/user/presentation/splash_screen.dart b/app_flowy/lib/user/presentation/splash_screen.dart
index a5a74e177b..5b9baee5bf 100644
--- a/app_flowy/lib/user/presentation/splash_screen.dart
+++ b/app_flowy/lib/user/presentation/splash_screen.dart
@@ -59,7 +59,9 @@ class SplashScreen extends StatelessWidget {
void _handleUnauthenticated(BuildContext context, Unauthenticated result) {
Log.error(result.error);
- getIt<ISplashRoute>().pushSignInScreen(context);
+ // getIt<ISplashRoute>().pushSignInScreen(context);
+
+ getIt<ISplashRoute>().pushSkipLoginScreen(context);
}
}
diff --git a/app_flowy/lib/user/presentation/widgets/background.dart b/app_flowy/lib/user/presentation/widgets/background.dart
index cfac6ac667..30c92be256 100644
--- a/app_flowy/lib/user/presentation/widgets/background.dart
+++ b/app_flowy/lib/user/presentation/widgets/background.dart
@@ -26,13 +26,13 @@ class AuthFormContainer extends StatelessWidget {
}
}
-class AuthFormTitle extends StatelessWidget {
+class FlowyLogoTitle extends StatelessWidget {
final String title;
final Size logoSize;
- const AuthFormTitle({
+ const FlowyLogoTitle({
Key? key,
required this.title,
- required this.logoSize,
+ this.logoSize = const Size.square(40),
}) : super(key: key);
@override
@@ -43,7 +43,7 @@ class AuthFormTitle extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox.fromSize(
- size: const Size.square(40),
+ size: logoSize,
child: svg("flowy_logo"),
),
const VSpace(30),