widget work

This commit is contained in:
Christien Rioux 2023-07-23 01:06:42 -04:00
parent c08878b35a
commit f06657d700
6 changed files with 134 additions and 50 deletions

View File

@ -1,63 +1,32 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:window_manager/window_manager.dart';
import 'package:user_profile_avatar/user_profile_avatar.dart';
import 'package:circular_profile_avatar/circular_profile_avatar.dart';
import 'package:badges/badges.dart';
import '../providers/local_accounts.dart';
import '../entities/local_account.dart';
import '../providers/logins.dart';
class AccountBubble extends ConsumerWidget {
const AccountBubble({super.key});
final LocalAccount account;
void _onReorder(WidgetRef ref, int oldIndex, int newIndex) {
final accounts = ref.read(localAccountsProvider.notifier);
accounts.reorderAccount(oldIndex, newIndex);
// xxx fix this so we can await this properly, use FutureBuilder or whatever
}
const AccountBubble({super.key, required this.account});
@override
Widget build(BuildContext context, WidgetRef ref) {
windowManager.setTitleBarStyle(TitleBarStyle.normal);
final accounts = ref.watch(localAccountsProvider);
final logins = ref.watch(loginsProvider);
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('Accounts'),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.settings),
tooltip: 'Accessibility',
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content:
Text('Accessibility and language options coming soon')));
},
),
],
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Spacer(),
accounts.when(
error: (obj, err) => Text("error loading accounts: $err"),
loading: () => CircularProgressIndicator(),
data: (accountList) => ReorderableGridView.extent(
maxCrossAxisExtent: 128,
onReorder: (oldIndex, newIndex) =>
_onReorder(ref, oldIndex, newIndex),
children: accountList.map((account) {
return AccountBubble(account);
}),
)),
const Spacer(),
],
),
),
);
return ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 300),
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
Expanded(
flex: 4,
child: CircularProfileAvatar("",
child: Container(color: Theme.of(context).disabledColor))),
Expanded(flex: 1, child: Text("Placeholder"))
]));
}
}

View File

@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:window_manager/window_manager.dart';
import 'package:reorderable_grid/reorderable_grid.dart';
import '../components/account_bubble.dart';
import '../providers/local_accounts.dart';
import '../providers/logins.dart';
@ -52,8 +53,8 @@ class LoginPage extends ConsumerWidget {
onReorder: (oldIndex, newIndex) =>
_onReorder(ref, oldIndex, newIndex),
children: accountList.map((account) {
return AccountBubble(account);
}),
return AccountBubble(account: account);
}).toList(),
)),
const Spacer(),
],

View File

@ -8,6 +8,7 @@ import Foundation
import path_provider_foundation
import screen_retriever
import shared_preferences_foundation
import sqflite
import veilid
import window_manager
@ -15,6 +16,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
VeilidPlugin.register(with: registry.registrar(forPlugin: "VeilidPlugin"))
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
}

View File

@ -1,5 +1,8 @@
PODS:
- FlutterMacOS (1.0.0)
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
@ -8,6 +11,9 @@ PODS:
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.2):
- FlutterMacOS
- FMDB (>= 2.7.5)
- veilid (0.0.1):
- FlutterMacOS
- window_manager (0.2.0):
@ -18,9 +24,14 @@ DEPENDENCIES:
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- screen_retriever (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`)
- veilid (from `Flutter/ephemeral/.symlinks/plugins/veilid/macos`)
- window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`)
SPEC REPOS:
trunk:
- FMDB
EXTERNAL SOURCES:
FlutterMacOS:
:path: Flutter/ephemeral
@ -30,6 +41,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos
shared_preferences_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
sqflite:
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos
veilid:
:path: Flutter/ephemeral/.symlinks/plugins/veilid/macos
window_manager:
@ -37,9 +50,11 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea
veilid: a54f57b7bcf0e4e072fe99272d76ca126b2026d0
window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8

View File

@ -57,6 +57,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.11.0"
badges:
dependency: "direct main"
description:
name: badges
sha256: "6e7f3ec561ec08f47f912cfe349d4a1707afdc8dda271e17b046aa6d42c89e77"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
boolean_selector:
dependency: transitive
description:
@ -129,6 +137,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.6.1"
cached_network_image:
dependency: transitive
description:
name: cached_network_image
sha256: fd3d0dc1d451f9a252b32d95d3f0c3c487bc41a75eba2e6097cb0b9c71491b15
url: "https://pub.dev"
source: hosted
version: "3.2.3"
cached_network_image_platform_interface:
dependency: transitive
description:
name: cached_network_image_platform_interface
sha256: bb2b8403b4ccdc60ef5f25c70dead1f3d32d24b9d6117cfc087f496b178594a7
url: "https://pub.dev"
source: hosted
version: "2.0.0"
cached_network_image_web:
dependency: transitive
description:
name: cached_network_image_web
sha256: b8eb814ebfcb4dea049680f8c1ffb2df399e4d03bf7a352c775e26fa06e02fa0
url: "https://pub.dev"
source: hosted
version: "1.0.2"
change_case:
dependency: "direct main"
description:
@ -169,6 +201,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.1.0"
circular_profile_avatar:
dependency: "direct main"
description:
name: circular_profile_avatar
sha256: "2ba47732e1d54b557e3ff033ab8ae58946b17d4bc268f6e3e6e3f58a90ac93c7"
url: "https://pub.dev"
source: hosted
version: "2.0.5"
cli_util:
dependency: transitive
description:
@ -310,6 +350,22 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_blurhash:
dependency: transitive
description:
name: flutter_blurhash
sha256: "05001537bd3fac7644fa6558b09ec8c0a3f2eba78c0765f88912882b1331a5c6"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba"
url: "https://pub.dev"
source: hosted
version: "3.3.1"
flutter_hooks:
dependency: "direct main"
description:
@ -429,6 +485,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.6"
http:
dependency: transitive
description:
name: http
sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
http_multi_server:
dependency: transitive
description:
@ -541,6 +605,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.4"
octo_image:
dependency: transitive
description:
name: octo_image
sha256: "107f3ed1330006a3bea63615e81cf637433f5135a52466c7caa0e7152bca9143"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
package_config:
dependency: transitive
description:
@ -834,6 +906,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.1"
sqflite:
dependency: transitive
description:
name: sqflite
sha256: b4d6710e1200e96845747e37338ea8a819a12b51689a3bcf31eff0003b37a0b9
url: "https://pub.dev"
source: hosted
version: "2.2.8+4"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
sha256: "8f7603f3f8f126740bc55c4ca2d1027aab4b74a1267a3e31ce51fe40e3b65b8f"
url: "https://pub.dev"
source: hosted
version: "2.4.5+1"
stack_trace:
dependency: transitive
description:
@ -874,6 +962,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
synchronized:
dependency: transitive
description:
name: synchronized
sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
system_info2:
dependency: transitive
description:

View File

@ -42,7 +42,8 @@ dependencies:
window_manager: ^0.3.5
flutter_svg: ^2.0.7
reorderable_grid: ^1.0.7
user_profile_avatar: ^0.1.2
circular_profile_avatar: ^2.0.5
badges: ^3.1.1
dev_dependencies:
flutter_test: