skip_log_in_screen.dart 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import 'package:app_flowy/user/domain/i_auth.dart';
  2. import 'package:app_flowy/user/presentation/widgets/background.dart';
  3. import 'package:flowy_infra/size.dart';
  4. import 'package:flowy_infra/theme.dart';
  5. import 'package:flowy_infra_ui/widget/rounded_button.dart';
  6. import 'package:flowy_infra_ui/widget/spacing.dart';
  7. import 'package:flutter/material.dart';
  8. import 'package:flutter_bloc/flutter_bloc.dart';
  9. import 'package:url_launcher/url_launcher.dart';
  10. class SkipLogInScreen extends StatelessWidget {
  11. final IAuthRouter router;
  12. final IAuth authManager;
  13. const SkipLogInScreen({Key? key, required this.router, required this.authManager}) : super(key: key);
  14. @override
  15. Widget build(BuildContext context) {
  16. return Scaffold(
  17. body: SignInForm(router: router),
  18. );
  19. }
  20. }
  21. class SignInForm extends StatelessWidget {
  22. final IAuthRouter router;
  23. const SignInForm({
  24. Key? key,
  25. required this.router,
  26. }) : super(key: key);
  27. @override
  28. Widget build(BuildContext context) {
  29. return Center(
  30. child: SizedBox(
  31. width: 400,
  32. height: 600,
  33. child: Column(
  34. mainAxisAlignment: MainAxisAlignment.center,
  35. children: [
  36. const FlowyLogoTitle(
  37. title: 'Welcome to AppFlowy',
  38. logoSize: Size.square(60),
  39. ),
  40. const VSpace(80),
  41. GoButton(onPressed: _autoRegister),
  42. const VSpace(30),
  43. Row(
  44. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  45. children: [
  46. InkWell(
  47. child: const Text(
  48. 'Star on Github',
  49. style: TextStyle(decoration: TextDecoration.underline, color: Colors.blue),
  50. ),
  51. onTap: () {
  52. _launchURL('https://github.com/AppFlowy-IO/appflowy');
  53. },
  54. ),
  55. const Spacer(),
  56. InkWell(
  57. child: const Text(
  58. 'Subscribe to Newsletter',
  59. style: TextStyle(decoration: TextDecoration.underline, color: Colors.blue),
  60. ),
  61. onTap: () {
  62. _launchURL('https://www.appflowy.io/blog');
  63. },
  64. ),
  65. ],
  66. )
  67. ],
  68. ),
  69. ),
  70. );
  71. }
  72. _launchURL(String url) async {
  73. if (await canLaunch(url)) {
  74. await launch(url);
  75. } else {
  76. throw 'Could not launch $url';
  77. }
  78. }
  79. void _autoRegister() {}
  80. }
  81. class GoButton extends StatelessWidget {
  82. final VoidCallback onPressed;
  83. const GoButton({
  84. Key? key,
  85. required this.onPressed,
  86. }) : super(key: key);
  87. @override
  88. Widget build(BuildContext context) {
  89. final theme = context.watch<AppTheme>();
  90. return RoundedTextButton(
  91. title: 'Let\'s Go',
  92. height: 50,
  93. borderRadius: Corners.s10Border,
  94. color: theme.main1,
  95. onPressed: onPressed,
  96. );
  97. }
  98. }