✨ Login hint
This commit is contained in:
parent
9aceabd83c
commit
99f3211151
@ -8,6 +8,7 @@ import 'package:solian/providers/content/channel.dart';
|
|||||||
import 'package:solian/router.dart';
|
import 'package:solian/router.dart';
|
||||||
import 'package:solian/screens/account/notification.dart';
|
import 'package:solian/screens/account/notification.dart';
|
||||||
import 'package:solian/theme.dart';
|
import 'package:solian/theme.dart';
|
||||||
|
import 'package:solian/widgets/account/signin_required_overlay.dart';
|
||||||
|
|
||||||
class ContactScreen extends StatefulWidget {
|
class ContactScreen extends StatefulWidget {
|
||||||
const ContactScreen({super.key});
|
const ContactScreen({super.key});
|
||||||
@ -48,28 +49,44 @@ class _ContactScreenState extends State<ContactScreen> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
|
|
||||||
// TODO Un signed in tip
|
|
||||||
|
|
||||||
return Material(
|
return Material(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
child: SafeArea(
|
child: FutureBuilder(
|
||||||
|
future: auth.isAuthorized,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (!snapshot.hasData) {
|
||||||
|
return const Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
|
} else if (snapshot.data == false) {
|
||||||
|
return SigninRequiredOverlay(
|
||||||
|
onSignedIn: () {
|
||||||
|
getChannels();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return SafeArea(
|
||||||
child: NestedScrollView(
|
child: NestedScrollView(
|
||||||
headerSliverBuilder: (context, innerBoxIsScrolled) {
|
headerSliverBuilder: (context, innerBoxIsScrolled) {
|
||||||
return [
|
return [
|
||||||
SliverOverlapAbsorber(
|
SliverOverlapAbsorber(
|
||||||
handle:
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
|
||||||
NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
context),
|
||||||
sliver: SliverAppBar(
|
sliver: SliverAppBar(
|
||||||
title: Text('contact'.tr),
|
title: Text('contact'.tr),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
titleSpacing: SolianTheme.isLargeScreen(context) ? null : 24,
|
titleSpacing:
|
||||||
|
SolianTheme.isLargeScreen(context) ? null : 24,
|
||||||
forceElevated: innerBoxIsScrolled,
|
forceElevated: innerBoxIsScrolled,
|
||||||
actions: [
|
actions: [
|
||||||
const NotificationButton(),
|
const NotificationButton(),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.add_circle),
|
icon: const Icon(Icons.add_circle),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
AppRouter.instance.pushNamed('channelOrganizing').then(
|
AppRouter.instance
|
||||||
|
.pushNamed('channelOrganizing')
|
||||||
|
.then(
|
||||||
(value) {
|
(value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
getChannels();
|
getChannels();
|
||||||
@ -91,7 +108,8 @@ class _ContactScreenState extends State<ContactScreen> {
|
|||||||
context: context,
|
context: context,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
if (_isBusy) const LinearProgressIndicator().animate().scaleX(),
|
if (_isBusy)
|
||||||
|
const LinearProgressIndicator().animate().scaleX(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: RefreshIndicator(
|
child: RefreshIndicator(
|
||||||
onRefresh: () => getChannels(),
|
onRefresh: () => getChannels(),
|
||||||
@ -131,7 +149,8 @@ class _ContactScreenState extends State<ContactScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
lib/screens/realms.dart
Normal file
10
lib/screens/realms.dart
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class RealmListScreen extends StatelessWidget {
|
||||||
|
const RealmListScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
|
}
|
@ -48,6 +48,8 @@ class SolianMessages extends Translations {
|
|||||||
'aspectRatioPortrait': 'Portrait',
|
'aspectRatioPortrait': 'Portrait',
|
||||||
'aspectRatioLandscape': 'Landscape',
|
'aspectRatioLandscape': 'Landscape',
|
||||||
'signin': 'Sign in',
|
'signin': 'Sign in',
|
||||||
|
'signinRequired': 'Sign in',
|
||||||
|
'signinRequiredHint': 'Sign in to get full access of Solar Network',
|
||||||
'signinGreeting': 'Welcome back\nSolar Network',
|
'signinGreeting': 'Welcome back\nSolar Network',
|
||||||
'signinCaption':
|
'signinCaption':
|
||||||
'Sign in to create post, start a realm, message your friend and more!',
|
'Sign in to create post, start a realm, message your friend and more!',
|
||||||
@ -160,6 +162,8 @@ class SolianMessages extends Translations {
|
|||||||
'aspectRatioPortrait': '竖型',
|
'aspectRatioPortrait': '竖型',
|
||||||
'aspectRatioLandscape': '横型',
|
'aspectRatioLandscape': '横型',
|
||||||
'signin': '登录',
|
'signin': '登录',
|
||||||
|
'signinRequired': '需要登录',
|
||||||
|
'signinRequiredHint': '登陆以获得 Solar Network 的全部功能使用权。',
|
||||||
'signinGreeting': '欢迎回来\nSolar Network',
|
'signinGreeting': '欢迎回来\nSolar Network',
|
||||||
'signinCaption': '登录以发表帖子、文章、创建领域、和你的朋友聊天,以及获取更多功能!',
|
'signinCaption': '登录以发表帖子、文章、创建领域、和你的朋友聊天,以及获取更多功能!',
|
||||||
'signinRiskDetected': '检测到风险,点击下一步按钮来打开一个网页,并通过在其上面登录来通过安全检查。',
|
'signinRiskDetected': '检测到风险,点击下一步按钮来打开一个网页,并通过在其上面登录来通过安全检查。',
|
||||||
|
50
lib/widgets/account/signin_required_overlay.dart
Normal file
50
lib/widgets/account/signin_required_overlay.dart
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/screens/auth/signin.dart';
|
||||||
|
|
||||||
|
class SigninRequiredOverlay extends StatelessWidget {
|
||||||
|
final Function onSignedIn;
|
||||||
|
|
||||||
|
const SigninRequiredOverlay({super.key, required this.onSignedIn});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GestureDetector(
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 280),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.login,
|
||||||
|
size: 48,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'signinRequired'.tr,
|
||||||
|
style: Theme.of(context).textTheme.titleLarge,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'signinRequiredHint'.tr,
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
showModalBottomSheet(
|
||||||
|
useRootNavigator: true,
|
||||||
|
isScrollControlled: true,
|
||||||
|
context: context,
|
||||||
|
builder: (context) => const SignInPopup(),
|
||||||
|
).then((value) {
|
||||||
|
if (value != null) onSignedIn();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user