✨ Better account page
This commit is contained in:
		@@ -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: Column(
 | 
				
			||||||
 | 
					            crossAxisAlignment: CrossAxisAlignment.start,
 | 
				
			||||||
 | 
					            children: [
 | 
				
			||||||
 | 
					              AspectRatio(
 | 
				
			||||||
 | 
					                aspectRatio: 16 / 7,
 | 
				
			||||||
 | 
					                child: Stack(
 | 
				
			||||||
 | 
					                  clipBehavior: Clip.none,
 | 
				
			||||||
 | 
					                  fit: StackFit.expand,
 | 
				
			||||||
 | 
					                  children: [
 | 
				
			||||||
 | 
					                    if (prof.body['banner'] != null)
 | 
				
			||||||
 | 
					                      Image.network(
 | 
				
			||||||
 | 
					                        '${ServiceFinder.services['paperclip']}/api/attachments/${prof.body['banner']}',
 | 
				
			||||||
 | 
					                        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: Card(
 | 
				
			||||||
                  child: ListTile(
 | 
					                  child: ListTile(
 | 
				
			||||||
              contentPadding:
 | 
					                    title: Text('description'.tr),
 | 
				
			||||||
                  const EdgeInsets.only(left: 22, right: 34, top: 4, bottom: 4),
 | 
					                    subtitle: Text(prof.body['description']?.isNotEmpty
 | 
				
			||||||
              leading: AccountAvatar(
 | 
					                        ? prof.body['description']
 | 
				
			||||||
                  content: snapshot.data!.body?['avatar'], radius: 24),
 | 
					                        : 'No description yet.'),
 | 
				
			||||||
              title: Text(snapshot.data!.body?['nick']),
 | 
					 | 
				
			||||||
              subtitle: Text(snapshot.data!.body?['email']),
 | 
					 | 
				
			||||||
                  ),
 | 
					                  ),
 | 
				
			||||||
          ).paddingOnly(
 | 
					                ),
 | 
				
			||||||
            left: 16,
 | 
					              ).paddingOnly(left: 24, right: 24, top: 8),
 | 
				
			||||||
            right: 16,
 | 
					            ],
 | 
				
			||||||
            top: SolianTheme.isLargeScreen(context) ? 8 : 0,
 | 
					 | 
				
			||||||
          ),
 | 
					          ),
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
				
			||||||
 | 
					          ? AppBar(
 | 
				
			||||||
              title: Text(state.topRoute?.name?.tr ?? 'page'.tr),
 | 
					              title: Text(state.topRoute?.name?.tr ?? 'page'.tr),
 | 
				
			||||||
              centerTitle: false,
 | 
					              centerTitle: false,
 | 
				
			||||||
              titleSpacing: canPop ? null : 24,
 | 
					              titleSpacing: canPop ? null : 24,
 | 
				
			||||||
              elevation: SolianTheme.isLargeScreen(context) ? 1 : 0,
 | 
					              elevation: SolianTheme.isLargeScreen(context) ? 1 : 0,
 | 
				
			||||||
              leading: canPop ? const PrevPageButton() : null,
 | 
					              leading: canPop ? const PrevPageButton() : null,
 | 
				
			||||||
              automaticallyImplyLeading: false,
 | 
					              automaticallyImplyLeading: false,
 | 
				
			||||||
      ),
 | 
					            )
 | 
				
			||||||
 | 
					          : null,
 | 
				
			||||||
      bottomNavigationBar: SolianTheme.isLargeScreen(context)
 | 
					      bottomNavigationBar: SolianTheme.isLargeScreen(context)
 | 
				
			||||||
          ? null
 | 
					          ? null
 | 
				
			||||||
          : const AppNavigationBottomBar(),
 | 
					          : const AppNavigationBottomBar(),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user