Change AppBar colors to be consistent across the app

This commit is contained in:
Nutcake 2023-06-24 13:34:25 +02:00
parent 37a2aebce5
commit d855d7dda3
9 changed files with 70 additions and 94 deletions

View file

@ -18,6 +18,7 @@ import 'package:contacts_plus_plus/widgets/update_notifier.dart';
import 'package:dynamic_color/dynamic_color.dart'; import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_downloader/flutter_downloader.dart'; import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:flutter_phoenix/flutter_phoenix.dart'; import 'package:flutter_phoenix/flutter_phoenix.dart';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';

View file

@ -51,7 +51,6 @@ class _FriendsListAppBarState extends State<FriendsListAppBar> with AutomaticKee
value: Provider.of<MessagingClient>(context, listen: false), value: Provider.of<MessagingClient>(context, listen: false),
child: AppBar( child: AppBar(
title: const Text("Contacts++"), title: const Text("Contacts++"),
backgroundColor: Theme.of(context).colorScheme.surfaceVariant,
actions: [ actions: [
FutureBuilder( FutureBuilder(
future: _userStatusFuture, future: _userStatusFuture,
@ -199,13 +198,6 @@ class _FriendsListAppBarState extends State<FriendsListAppBar> with AutomaticKee
), ),
) )
], ],
bottom: PreferredSize(
preferredSize: const Size.fromHeight(1),
child: Container(
height: 1,
color: Colors.black,
),
),
), ),
); );
} }

View file

@ -52,6 +52,7 @@ class _HomeState extends State<Home> {
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
), ),
child: BottomNavigationBar( child: BottomNavigationBar(
backgroundColor: Theme.of(context).colorScheme.surface,
type: BottomNavigationBarType.fixed, type: BottomNavigationBarType.fixed,
unselectedItemColor: Theme.of(context).colorScheme.onBackground, unselectedItemColor: Theme.of(context).colorScheme.onBackground,
selectedItemColor: Theme.of(context).colorScheme.primary, selectedItemColor: Theme.of(context).colorScheme.primary,

View file

@ -52,7 +52,7 @@ class _MessagesListState extends State<MessagesList> with SingleTickerProviderSt
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final appBarColor = Theme.of(context).colorScheme.surfaceVariant; final appBarColor = Theme.of(context).colorScheme.surface;
return Consumer<MessagingClient>(builder: (context, mClient, _) { return Consumer<MessagingClient>(builder: (context, mClient, _) {
final friend = mClient.selectedFriend ?? Friend.empty(); final friend = mClient.selectedFriend ?? Friend.empty();
final cache = mClient.getUserMessageCache(friend.id); final cache = mClient.getUserMessageCache(friend.id);
@ -79,15 +79,6 @@ class _MessagesListState extends State<MessagesList> with SingleTickerProviderSt
), ),
], ],
), ),
bottom: sessions.isNotEmpty && _sessionListOpen
? null
: PreferredSize(
preferredSize: const Size.fromHeight(1),
child: Container(
height: 1,
color: Colors.black,
),
),
actions: [ actions: [
if (sessions.isNotEmpty) if (sessions.isNotEmpty)
AnimatedRotation( AnimatedRotation(
@ -107,9 +98,6 @@ class _MessagesListState extends State<MessagesList> with SingleTickerProviderSt
) )
], ],
scrolledUnderElevation: 0.0, scrolledUnderElevation: 0.0,
backgroundColor: appBarColor,
surfaceTintColor: Colors.transparent,
shadowColor: Colors.transparent,
), ),
body: Column( body: Column(
children: [ children: [
@ -122,11 +110,11 @@ class _MessagesListState extends State<MessagesList> with SingleTickerProviderSt
? null ? null
: Container( : Container(
constraints: const BoxConstraints(maxHeight: 64), constraints: const BoxConstraints(maxHeight: 64),
decoration: BoxDecoration( decoration: const BoxDecoration(
color: appBarColor, border: Border(
border: const Border(
bottom: BorderSide(width: 1, color: Colors.black), bottom: BorderSide(width: 1, color: Colors.black),
)), ),
),
child: Stack( child: Stack(
children: [ children: [
ListView.builder( ListView.builder(

View file

@ -35,19 +35,24 @@ class SessionPopup extends StatelessWidget {
FormattedText(session.formattedName, style: Theme.of(context).textTheme.titleMedium), FormattedText(session.formattedName, style: Theme.of(context).textTheme.titleMedium),
session.formattedDescription.isEmpty session.formattedDescription.isEmpty
? const Text("No description") ? const Text("No description")
: FormattedText(session.formattedDescription, style: Theme.of(context).textTheme.labelMedium), : FormattedText(session.formattedDescription,
Text("Tags: ${session.tags.isEmpty ? "None" : session.tags.join(", ")}", style: Theme.of(context).textTheme.labelMedium),
Text(
"Tags: ${session.tags.isEmpty ? "None" : session.tags.join(", ")}",
style: Theme.of(context).textTheme.labelMedium, style: Theme.of(context).textTheme.labelMedium,
softWrap: true, softWrap: true,
), ),
Text("Access: ${session.accessLevel.toReadableString()}", style: Theme.of(context).textTheme.labelMedium), Text("Access: ${session.accessLevel.toReadableString()}",
style: Theme.of(context).textTheme.labelMedium),
Text("Users: ${session.sessionUsers.length}", style: Theme.of(context).textTheme.labelMedium), Text("Users: ${session.sessionUsers.length}", style: Theme.of(context).textTheme.labelMedium),
Text("Maximum users: ${session.maxUsers}", style: Theme.of(context).textTheme.labelMedium), Text("Maximum users: ${session.maxUsers}", style: Theme.of(context).textTheme.labelMedium),
Text("Headless: ${session.headlessHost ? "Yes" : "No"}", style: Theme.of(context).textTheme.labelMedium), Text("Headless: ${session.headlessHost ? "Yes" : "No"}",
style: Theme.of(context).textTheme.labelMedium),
], ],
), ),
), ),
if (session.sessionUsers.isNotEmpty) Expanded( if (session.sessionUsers.isNotEmpty)
Expanded(
child: Scrollbar( child: Scrollbar(
trackVisibility: true, trackVisibility: true,
controller: userListScrollController, controller: userListScrollController,
@ -60,13 +65,21 @@ class SessionPopup extends StatelessWidget {
final user = session.sessionUsers[index]; final user = session.sessionUsers[index];
return ListTile( return ListTile(
dense: true, dense: true,
title: Text(user.username, textAlign: TextAlign.end,), title: Text(
subtitle: Text(user.isPresent ? "Active" : "Inactive", textAlign: TextAlign.end,), user.username,
textAlign: TextAlign.end,
),
subtitle: Text(
user.isPresent ? "Active" : "Inactive",
textAlign: TextAlign.end,
),
); );
}, },
), ),
), ),
) else const Expanded( )
else
const Expanded(
child: Center( child: Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -74,7 +87,10 @@ class SessionPopup extends StatelessWidget {
Icon(Icons.person_remove_alt_1_rounded), Icon(Icons.person_remove_alt_1_rounded),
Padding( Padding(
padding: EdgeInsets.all(16.0), padding: EdgeInsets.all(16.0),
child: Text("No one is currently playing.", textAlign: TextAlign.center,), child: Text(
"No one is currently playing.",
textAlign: TextAlign.center,
),
) )
], ],
), ),
@ -114,11 +130,15 @@ class SessionPopup extends StatelessWidget {
class SessionTile extends StatelessWidget { class SessionTile extends StatelessWidget {
const SessionTile({required this.session, super.key}); const SessionTile({required this.session, super.key});
final Session session; final Session session;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return TextButton( return TextButton(
style: TextButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.onSurface,
),
onPressed: () { onPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => SessionView(session: session))); Navigator.of(context).push(MaterialPageRoute(builder: (context) => SessionView(session: session)));
}, },
@ -133,7 +153,10 @@ class SessionTile extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
FormattedText(session.formattedName), FormattedText(session.formattedName),
Text("${session.sessionUsers.length.toString().padLeft(2, "0")}/${session.maxUsers.toString().padLeft(2, "0")} active users") Text(
"${session.sessionUsers.length.toString().padLeft(2, "0")}/${session.maxUsers.toString().padLeft(2, "0")} active users",
style: Theme.of(context).textTheme.labelMedium?.copyWith(color: Theme.of(context).colorScheme.onSurface.withOpacity(.6)),
)
], ],
), ),
) )

View file

@ -15,14 +15,6 @@ class _SessionListAppBarState extends State<SessionListAppBar> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppBar( return AppBar(
title: const Text("Sessions"), title: const Text("Sessions"),
backgroundColor: Theme.of(context).colorScheme.surfaceVariant,
bottom: PreferredSize(
preferredSize: const Size.fromHeight(1),
child: Container(
height: 1,
color: Colors.black,
),
),
actions: [ actions: [
Padding( Padding(
padding: const EdgeInsets.only(right: 4.0), padding: const EdgeInsets.only(right: 4.0),

View file

@ -48,20 +48,7 @@ class _SessionViewState extends State<SessionView> {
maxLines: 1, maxLines: 1,
style: Theme.of(context).textTheme.titleLarge, style: Theme.of(context).textTheme.titleLarge,
), ),
bottom: PreferredSize( scrolledUnderElevation: 0,
preferredSize: const Size.fromHeight(1),
child: Row(
children: [
Expanded(
child: Container(
width: double.infinity,
height: 1,
color: Colors.black,
),
),
],
),
),
), ),
body: RefreshIndicator( body: RefreshIndicator(
onRefresh: () async { onRefresh: () async {

View file

@ -6,15 +6,7 @@ class SettingsAppBar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppBar( return AppBar(
backgroundColor: Theme.of(context).colorScheme.surfaceVariant,
title: const Text("Settings"), title: const Text("Settings"),
bottom: PreferredSize(
preferredSize: const Size.fromHeight(1),
child: Container(
height: 1,
color: Colors.black,
),
),
); );
} }

View file

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.3.2+1 version: 1.4.1+1
environment: environment:
sdk: '>=3.0.1' sdk: '>=3.0.1'