|
@@ -1,21 +1,25 @@
|
|
-import 'package:app_flowy/user/application/auth_service.dart';
|
|
|
|
-import 'package:app_flowy/user/presentation/router.dart';
|
|
|
|
-import 'package:app_flowy/user/presentation/widgets/background.dart';
|
|
|
|
|
|
+import 'package:dartz/dartz.dart' as dartz;
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flowy_infra/size.dart';
|
|
import 'package:flowy_infra/size.dart';
|
|
-import 'package:flowy_infra/uuid.dart';
|
|
|
|
-import 'package:flowy_infra_ui/style_widget/text.dart';
|
|
|
|
|
|
+import 'package:flowy_infra_ui/style_widget/button.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_sdk/log.dart';
|
|
|
|
import 'package:flowy_sdk/dispatch/dispatch.dart';
|
|
import 'package:flowy_sdk/dispatch/dispatch.dart';
|
|
-import 'package:flowy_sdk/protobuf/flowy-folder/protobuf.dart';
|
|
|
|
|
|
+import 'package:flowy_sdk/log.dart';
|
|
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
|
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
|
|
|
+import 'package:flowy_sdk/protobuf/flowy-folder/protobuf.dart';
|
|
import 'package:flowy_sdk/protobuf/flowy-user/user_profile.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:url_launcher/url_launcher.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
-import 'package:dartz/dartz.dart' as dartz;
|
|
|
|
-import 'package:app_flowy/generated/locale_keys.g.dart';
|
|
|
|
|
|
+
|
|
|
|
+import '../../generated/locale_keys.g.dart';
|
|
|
|
+import '../../main.dart';
|
|
|
|
+import '../../startup/launch_configuration.dart';
|
|
|
|
+import '../../startup/startup.dart';
|
|
|
|
+import '../application/auth_service.dart';
|
|
|
|
+import 'folder/folder_widget.dart';
|
|
|
|
+import 'router.dart';
|
|
|
|
+import 'widgets/background.dart';
|
|
|
|
|
|
class SkipLogInScreen extends StatefulWidget {
|
|
class SkipLogInScreen extends StatefulWidget {
|
|
final AuthRouter router;
|
|
final AuthRouter router;
|
|
@@ -36,11 +40,7 @@ class _SkipLogInScreenState extends State<SkipLogInScreen> {
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
return Scaffold(
|
|
body: Center(
|
|
body: Center(
|
|
- child: SizedBox(
|
|
|
|
- width: 400,
|
|
|
|
- height: 600,
|
|
|
|
- child: _renderBody(context),
|
|
|
|
- ),
|
|
|
|
|
|
+ child: _renderBody(context),
|
|
),
|
|
),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -53,33 +53,57 @@ class _SkipLogInScreenState extends State<SkipLogInScreen> {
|
|
title: LocaleKeys.welcomeText.tr(),
|
|
title: LocaleKeys.welcomeText.tr(),
|
|
logoSize: const Size.square(60),
|
|
logoSize: const Size.square(60),
|
|
),
|
|
),
|
|
- const VSpace(80),
|
|
|
|
- GoButton(onPressed: () => _autoRegister(context)),
|
|
|
|
- const VSpace(30),
|
|
|
|
- Row(
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
- children: [
|
|
|
|
- InkWell(
|
|
|
|
- hoverColor: Colors.transparent,
|
|
|
|
- onTap: () =>
|
|
|
|
- _launchURL('https://github.com/AppFlowy-IO/appflowy'),
|
|
|
|
- child: FlowyText.medium(
|
|
|
|
- LocaleKeys.githubStarText.tr(),
|
|
|
|
- color: Theme.of(context).colorScheme.primary,
|
|
|
|
- decoration: TextDecoration.underline,
|
|
|
|
- ),
|
|
|
|
- ),
|
|
|
|
- InkWell(
|
|
|
|
- hoverColor: Colors.transparent,
|
|
|
|
- onTap: () => _launchURL('https://www.appflowy.io/blog'),
|
|
|
|
- child: FlowyText.medium(
|
|
|
|
- LocaleKeys.subscribeNewsletterText.tr(),
|
|
|
|
- color: Theme.of(context).colorScheme.primary,
|
|
|
|
- decoration: TextDecoration.underline,
|
|
|
|
- ),
|
|
|
|
- ),
|
|
|
|
- ],
|
|
|
|
- )
|
|
|
|
|
|
+ const VSpace(40),
|
|
|
|
+ SizedBox(
|
|
|
|
+ width: 250,
|
|
|
|
+ child: GoButton(onPressed: () => _autoRegister(context)),
|
|
|
|
+ ),
|
|
|
|
+ const VSpace(20),
|
|
|
|
+ SizedBox(
|
|
|
|
+ width: MediaQuery.of(context).size.width * 0.8,
|
|
|
|
+ child: FolderWidget(
|
|
|
|
+ createFolderCallback: () async {
|
|
|
|
+ await FlowyRunner.run(
|
|
|
|
+ FlowyApp(),
|
|
|
|
+ config: const LaunchConfiguration(
|
|
|
|
+ autoRegistrationSupported: true,
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ const VSpace(20),
|
|
|
|
+ SizedBox(
|
|
|
|
+ width: 400,
|
|
|
|
+ child: _buildSubscribeButtons(context),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Row _buildSubscribeButtons(BuildContext context) {
|
|
|
|
+ return Row(
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
+ children: [
|
|
|
|
+ FlowyTextButton(
|
|
|
|
+ LocaleKeys.githubStarText.tr(),
|
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
|
+ fontColor: Theme.of(context).colorScheme.primary,
|
|
|
|
+ decoration: TextDecoration.underline,
|
|
|
|
+ hoverColor: Colors.transparent,
|
|
|
|
+ fillColor: Colors.transparent,
|
|
|
|
+ onPressed: () =>
|
|
|
|
+ _launchURL('https://github.com/AppFlowy-IO/appflowy'),
|
|
|
|
+ ),
|
|
|
|
+ FlowyTextButton(
|
|
|
|
+ LocaleKeys.subscribeNewsletterText.tr(),
|
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
|
+ fontColor: Theme.of(context).colorScheme.primary,
|
|
|
|
+ decoration: TextDecoration.underline,
|
|
|
|
+ hoverColor: Colors.transparent,
|
|
|
|
+ fillColor: Colors.transparent,
|
|
|
|
+ onPressed: () => _launchURL('https://www.appflowy.io/blog'),
|
|
|
|
+ ),
|
|
],
|
|
],
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -93,15 +117,8 @@ class _SkipLogInScreenState extends State<SkipLogInScreen> {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- void _autoRegister(BuildContext context) async {
|
|
|
|
- const password = "AppFlowy123@";
|
|
|
|
- final uid = uuid();
|
|
|
|
- final userEmail = "[email protected]";
|
|
|
|
- final result = await widget.authService.signUp(
|
|
|
|
- name: LocaleKeys.defaultUsername.tr(),
|
|
|
|
- password: password,
|
|
|
|
- email: userEmail,
|
|
|
|
- );
|
|
|
|
|
|
+ Future<void> _autoRegister(BuildContext context) async {
|
|
|
|
+ final result = await widget.authService.signUpWithRandomUser();
|
|
result.fold(
|
|
result.fold(
|
|
(user) {
|
|
(user) {
|
|
FolderEventReadCurrentWorkspace().send().then((result) {
|
|
FolderEventReadCurrentWorkspace().send().then((result) {
|