Add multi-account support and update project docs
- Add SavedAccount/AccountStore and rework ServerProvider around a list of saved accounts: switch/remove/add, swipe-to-cycle on the avatar button, per-account browsing prefs (sort/view/filters/cache), and a session-generation guard so a stale fetch from an abandoned account can't land in the newly active one - Migrate existing single-account installs into the new schema automatically so upgrading users stay logged in - Settings gains an Accounts section; LoginView gains an "add account" mode pushed on top of the main shell instead of replacing it - Give every Scrollbar in the app a thicker, draggable, Android-style thumb via a shared ScrollbarTheme instead of the default hairline - Splash screen: use the monochrome app icon (tinted per theme) and a smaller spinner - Update CLAUDE.md and .claude/context/*.md to reflect the accumulated multi-account, sharing, and UI changes across this session, and add a standing instruction to keep these docs current going forward Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../providers/server_provider.dart';
|
||||
import '../views/account_view.dart';
|
||||
|
||||
/// Top-bar avatar button that opens the account screen. Replaces the old
|
||||
/// "Account" bottom-nav destination, matching how Google Drive surfaces
|
||||
/// account access from a profile picture in the app bar.
|
||||
/// account access from a profile picture in the app bar. Also doubles as a
|
||||
/// quick account switcher: swiping up/down on it cycles to the next/
|
||||
/// previous saved account immediately, with no confirmation - a shortcut
|
||||
/// alongside the full switcher list in Settings.
|
||||
class ProfileAvatarButton extends StatelessWidget {
|
||||
const ProfileAvatarButton({super.key});
|
||||
|
||||
void _handleVerticalSwipe(BuildContext context, DragEndDetails details) {
|
||||
final velocity = details.primaryVelocity ?? 0;
|
||||
if (velocity.abs() < 250) return;
|
||||
|
||||
final provider = context.read<ServerProvider>();
|
||||
final target = velocity < 0
|
||||
? provider.cycleToNextAccount()
|
||||
: provider.cycleToPreviousAccount();
|
||||
if (target == null) return;
|
||||
|
||||
HapticFeedback.selectionClick();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Switched to ${target.username}'),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final provider = context.watch<ServerProvider>();
|
||||
@@ -19,23 +42,26 @@ class ProfileAvatarButton extends StatelessWidget {
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 8),
|
||||
child: IconButton(
|
||||
tooltip: 'Settings',
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const AccountView()),
|
||||
);
|
||||
},
|
||||
icon: CircleAvatar(
|
||||
radius: 17,
|
||||
backgroundColor: colorScheme.primary,
|
||||
child: Text(
|
||||
initial,
|
||||
style: TextStyle(
|
||||
color: colorScheme.onPrimary,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
child: GestureDetector(
|
||||
onVerticalDragEnd: (details) => _handleVerticalSwipe(context, details),
|
||||
child: IconButton(
|
||||
tooltip: 'Settings',
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const AccountView()),
|
||||
);
|
||||
},
|
||||
icon: CircleAvatar(
|
||||
radius: 17,
|
||||
backgroundColor: colorScheme.primary,
|
||||
child: Text(
|
||||
initial,
|
||||
style: TextStyle(
|
||||
color: colorScheme.onPrimary,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user