Improve adherence to material design guidelines

This commit is contained in:
Nutcake 2023-09-29 16:24:26 +02:00
parent b1f2d65ab8
commit e3837066bb
9 changed files with 59 additions and 52 deletions

View file

@ -14,6 +14,7 @@ import 'package:contacts_plus_plus/widgets/update_notifier.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:flutter_phoenix/flutter_phoenix.dart';
import 'package:hive_flutter/hive_flutter.dart';
@ -132,12 +133,14 @@ class _ContactsPlusPlusState extends State<ContactsPlusPlus> {
theme: ThemeData(
useMaterial3: true,
textTheme: _typography.black,
canvasColor: lightDynamic?.surfaceVariant,
colorScheme:
lightDynamic ?? ColorScheme.fromSeed(seedColor: Colors.purple, brightness: Brightness.light),
),
darkTheme: ThemeData(
useMaterial3: true,
textTheme: _typography.white,
canvasColor: darkDynamic?.surfaceVariant,
colorScheme: darkDynamic ?? ColorScheme.fromSeed(seedColor: Colors.purple, brightness: Brightness.dark),
),
themeMode: ThemeMode.values[widget.settingsClient.currentSettings.themeMode.valueOrDefault],

View file

@ -20,7 +20,7 @@ class Friend implements Comparable {
required this.contactStatus, required this.latestMessageTime,
});
bool get isHeadless => userStatus.activeSessions.any((session) => session.headlessHost == true && session.hostUserId == id);
bool get isHeadless => userStatus.outputDevice == "Headless";
factory Friend.fromMap(Map map) {
var userStatus = map["userStatus"] == null ? UserStatus.empty() : UserStatus.fromMap(map["userStatus"]);

View file

@ -6,6 +6,7 @@ import 'package:contacts_plus_plus/models/users/user_status.dart';
import 'package:contacts_plus_plus/widgets/friends/user_search.dart';
import 'package:contacts_plus_plus/widgets/my_profile_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
@ -49,6 +50,9 @@ class _FriendsListAppBarState extends State<FriendsListAppBar> with AutomaticKee
super.build(context);
return AppBar(
title: const Text("Contacts++"),
systemOverlayStyle: SystemUiOverlayStyle(
systemNavigationBarColor: Theme.of(context).colorScheme.surfaceVariant,
),
actions: [
FutureBuilder(
future: _userStatusFuture,

View file

@ -29,6 +29,7 @@ class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(kToolbarHeight),
child: AnimatedSwitcher(
@ -46,13 +47,8 @@ class _HomeState extends State<Home> {
SettingsPage(),
],
),
bottomNavigationBar: Container(
decoration: BoxDecoration(
border: const Border(top: BorderSide(width: 1, color: Colors.black)),
color: Theme.of(context).colorScheme.background,
),
child: BottomNavigationBar(
backgroundColor: Theme.of(context).colorScheme.surface,
bottomNavigationBar: BottomNavigationBar(
backgroundColor: Theme.of(context).colorScheme.surfaceVariant,
type: BottomNavigationBarType.fixed,
unselectedItemColor: Theme.of(context).colorScheme.onBackground,
selectedItemColor: Theme.of(context).colorScheme.primary,
@ -86,7 +82,6 @@ class _HomeState extends State<Home> {
),
],
),
),
);
}
}

View file

@ -5,6 +5,7 @@ import 'package:contacts_plus_plus/auxiliary.dart';
import 'package:contacts_plus_plus/clients/inventory_client.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:path/path.dart';
import 'package:provider/provider.dart';
@ -60,10 +61,16 @@ class _InventoryBrowserAppBarState extends State<InventoryBrowserAppBar> {
? AppBar(
key: const ValueKey("default-appbar"),
title: const Text("Inventory"),
systemOverlayStyle: SystemUiOverlayStyle(
systemNavigationBarColor: Theme.of(context).colorScheme.surfaceVariant,
),
)
: AppBar(
key: const ValueKey("selection-appbar"),
title: Text("${iClient.selectedRecordCount} Selected"),
systemOverlayStyle: SystemUiOverlayStyle(
systemNavigationBarColor: Theme.of(context).colorScheme.surfaceVariant,
),
leading: IconButton(
onPressed: () {
iClient.clearSelectedRecords();

View file

@ -3,6 +3,7 @@ import 'package:contacts_plus_plus/clients/session_client.dart';
import 'package:contacts_plus_plus/clients/settings_client.dart';
import 'package:contacts_plus_plus/widgets/sessions/session_filter_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
class SessionListAppBar extends StatefulWidget {
@ -17,6 +18,9 @@ class _SessionListAppBarState extends State<SessionListAppBar> {
Widget build(BuildContext context) {
return AppBar(
title: const Text("Sessions"),
systemOverlayStyle: SystemUiOverlayStyle(
systemNavigationBarColor: Theme.of(context).colorScheme.surfaceVariant,
),
actions: [
Padding(
padding: const EdgeInsets.only(right: 4.0),

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class SettingsAppBar extends StatelessWidget {
const SettingsAppBar({super.key});
@ -7,7 +8,9 @@ class SettingsAppBar extends StatelessWidget {
Widget build(BuildContext context) {
return AppBar(
title: const Text("Settings"),
systemOverlayStyle: SystemUiOverlayStyle(
systemNavigationBarColor: Theme.of(context).colorScheme.surfaceVariant,
),
);
}
}

View file

@ -153,14 +153,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.17.2"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be
url: "https://pub.dev"
source: hosted
version: "1.0.5"
dbus:
dependency: transitive
description:

View file

@ -31,7 +31,6 @@ dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
http: ^0.13.5
http_parser: ^4.0.2
uuid: ^3.0.7