|
@@ -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/domain/i_auth.dart';
|
|
import 'package:app_flowy/user/presentation/widgets/background.dart';
|
|
import 'package:app_flowy/user/presentation/widgets/background.dart';
|
|
import 'package:flowy_infra/size.dart';
|
|
import 'package:flowy_infra/size.dart';
|
|
import 'package:flowy_infra/theme.dart';
|
|
import 'package:flowy_infra/theme.dart';
|
|
import 'package:flowy_infra_ui/widget/rounded_button.dart';
|
|
import 'package:flowy_infra_ui/widget/rounded_button.dart';
|
|
import 'package:flowy_infra_ui/widget/spacing.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/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
-import 'package:dartz/dartz.dart';
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
class SkipLogInScreen extends StatelessWidget {
|
|
class SkipLogInScreen extends StatelessWidget {
|
|
final IAuthRouter router;
|
|
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
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
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) {
|
|
Widget build(BuildContext context) {
|
|
return Center(
|
|
return Center(
|
|
child: SizedBox(
|
|
child: SizedBox(
|
|
- width: 600,
|
|
|
|
|
|
+ width: 400,
|
|
height: 600,
|
|
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';
|
|
throw 'Could not launch $url';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ void _autoRegister() {}
|
|
}
|
|
}
|
|
|
|
|
|
class GoButton extends StatelessWidget {
|
|
class GoButton extends StatelessWidget {
|
|
|
|
+ final VoidCallback onPressed;
|
|
const GoButton({
|
|
const GoButton({
|
|
Key? key,
|
|
Key? key,
|
|
|
|
+ required this.onPressed,
|
|
}) : super(key: key);
|
|
}) : super(key: key);
|
|
|
|
|
|
@override
|
|
@override
|
|
@@ -120,12 +97,10 @@ class GoButton extends StatelessWidget {
|
|
final theme = context.watch<AppTheme>();
|
|
final theme = context.watch<AppTheme>();
|
|
return RoundedTextButton(
|
|
return RoundedTextButton(
|
|
title: 'Let\'s Go',
|
|
title: 'Let\'s Go',
|
|
- height: 60,
|
|
|
|
|
|
+ height: 50,
|
|
borderRadius: Corners.s10Border,
|
|
borderRadius: Corners.s10Border,
|
|
color: theme.main1,
|
|
color: theme.main1,
|
|
- onPressed: () {
|
|
|
|
- //to do: direct to the workspace
|
|
|
|
- },
|
|
|
|
|
|
+ onPressed: onPressed,
|
|
);
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|