✨ Better account page
This commit is contained in:
parent
d98d167f4c
commit
3e640768c8
@ -15,7 +15,7 @@ abstract class AppRouter {
|
|||||||
routes: [
|
routes: [
|
||||||
ShellRoute(
|
ShellRoute(
|
||||||
builder: (context, state, child) =>
|
builder: (context, state, child) =>
|
||||||
NavShell(state: state, child: child),
|
NavShell(state: state, child: child, showAppBar: false),
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/',
|
path: '/',
|
||||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/router.dart';
|
import 'package:solian/router.dart';
|
||||||
|
import 'package:solian/services.dart';
|
||||||
import 'package:solian/theme.dart';
|
import 'package:solian/theme.dart';
|
||||||
import 'package:solian/widgets/account/account_avatar.dart';
|
import 'package:solian/widgets/account/account_avatar.dart';
|
||||||
|
|
||||||
@ -100,25 +101,67 @@ class AccountNameCard extends StatelessWidget {
|
|||||||
future: provider.getProfile(),
|
future: provider.getProfile(),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (!snapshot.hasData) {
|
if (!snapshot.hasData) {
|
||||||
return const Center(
|
return Container();
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final prof = snapshot.data!;
|
||||||
return Material(
|
return Material(
|
||||||
child: Card(
|
child: Column(
|
||||||
child: ListTile(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
contentPadding:
|
children: [
|
||||||
const EdgeInsets.only(left: 22, right: 34, top: 4, bottom: 4),
|
AspectRatio(
|
||||||
leading: AccountAvatar(
|
aspectRatio: 16 / 7,
|
||||||
content: snapshot.data!.body?['avatar'], radius: 24),
|
child: Stack(
|
||||||
title: Text(snapshot.data!.body?['nick']),
|
clipBehavior: Clip.none,
|
||||||
subtitle: Text(snapshot.data!.body?['email']),
|
fit: StackFit.expand,
|
||||||
),
|
children: [
|
||||||
).paddingOnly(
|
if (prof.body['banner'] != null)
|
||||||
left: 16,
|
Image.network(
|
||||||
right: 16,
|
'${ServiceFinder.services['paperclip']}/api/attachments/${prof.body['banner']}',
|
||||||
top: SolianTheme.isLargeScreen(context) ? 8 : 0,
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
bottom: -30,
|
||||||
|
left: 18,
|
||||||
|
child: AccountAvatar(
|
||||||
|
content: prof.body['avatar'],
|
||||||
|
radius: 48,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.baseline,
|
||||||
|
textBaseline: TextBaseline.alphabetic,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
prof.body['nick'],
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
).paddingOnly(right: 4),
|
||||||
|
Text(
|
||||||
|
'@${prof.body['name']}',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).paddingOnly(left: 120, top: 8),
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: Card(
|
||||||
|
child: ListTile(
|
||||||
|
title: Text('description'.tr),
|
||||||
|
subtitle: Text(prof.body['description']?.isNotEmpty
|
||||||
|
? prof.body['description']
|
||||||
|
: 'No description yet.'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
).paddingOnly(left: 24, right: 24, top: 8),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -8,24 +8,32 @@ import 'package:solian/widgets/navigation/app_navigation_bottom_bar.dart';
|
|||||||
import 'package:solian/widgets/navigation/app_navigation_rail.dart';
|
import 'package:solian/widgets/navigation/app_navigation_rail.dart';
|
||||||
|
|
||||||
class NavShell extends StatelessWidget {
|
class NavShell extends StatelessWidget {
|
||||||
|
final bool showAppBar;
|
||||||
final GoRouterState state;
|
final GoRouterState state;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
const NavShell({super.key, required this.child, required this.state});
|
const NavShell({
|
||||||
|
super.key,
|
||||||
|
required this.child,
|
||||||
|
required this.state,
|
||||||
|
this.showAppBar = true,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final canPop = AppRouter.instance.canPop();
|
final canPop = AppRouter.instance.canPop();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: showAppBar
|
||||||
title: Text(state.topRoute?.name?.tr ?? 'page'.tr),
|
? AppBar(
|
||||||
centerTitle: false,
|
title: Text(state.topRoute?.name?.tr ?? 'page'.tr),
|
||||||
titleSpacing: canPop ? null : 24,
|
centerTitle: false,
|
||||||
elevation: SolianTheme.isLargeScreen(context) ? 1 : 0,
|
titleSpacing: canPop ? null : 24,
|
||||||
leading: canPop ? const PrevPageButton() : null,
|
elevation: SolianTheme.isLargeScreen(context) ? 1 : 0,
|
||||||
automaticallyImplyLeading: false,
|
leading: canPop ? const PrevPageButton() : null,
|
||||||
),
|
automaticallyImplyLeading: false,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
bottomNavigationBar: SolianTheme.isLargeScreen(context)
|
bottomNavigationBar: SolianTheme.isLargeScreen(context)
|
||||||
? null
|
? null
|
||||||
: const AppNavigationBottomBar(),
|
: const AppNavigationBottomBar(),
|
||||||
|
Loading…
Reference in New Issue
Block a user