Accent color is no longer used in flutter 2.5

This commit is contained in:
Ming Ming 2021-09-16 00:29:37 +08:00
parent dfb090f02a
commit c74d430747
12 changed files with 68 additions and 61 deletions

View file

@ -222,7 +222,9 @@ class _AlbumBrowserState extends State<AlbumBrowser>
context,
child: Theme(
data: Theme.of(context).copyWith(
accentColor: AppTheme.getOverscrollIndicatorColor(context),
colorScheme: Theme.of(context).colorScheme.copyWith(
secondary: AppTheme.getOverscrollIndicatorColor(context),
),
),
child: content,
),

View file

@ -156,16 +156,11 @@ class _AlbumImporterState extends State<AlbumImporter> {
}
Widget _buildList(BuildContext context, ListImportableAlbumBlocState state) {
return Theme(
data: Theme.of(context).copyWith(
accentColor: AppTheme.getOverscrollIndicatorColor(context),
),
child: ListView.separated(
itemBuilder: (context, index) =>
_buildItem(context, _backingFiles[index]),
separatorBuilder: (context, index) => const Divider(),
itemCount: _backingFiles.length,
),
return ListView.separated(
itemBuilder: (context, index) =>
_buildItem(context, _backingFiles[index]),
separatorBuilder: (context, index) => const Divider(),
itemCount: _backingFiles.length,
);
}

View file

@ -119,7 +119,9 @@ class _ArchiveBrowserState extends State<ArchiveBrowser>
context,
child: Theme(
data: Theme.of(context).copyWith(
accentColor: AppTheme.getOverscrollIndicatorColor(context),
colorScheme: Theme.of(context).colorScheme.copyWith(
secondary: AppTheme.getOverscrollIndicatorColor(context),
),
),
child: CustomScrollView(
slivers: [

View file

@ -12,7 +12,6 @@ import 'package:nc_photos/entity/file.dart';
import 'package:nc_photos/exception_util.dart' as exception_util;
import 'package:nc_photos/k.dart' as k;
import 'package:nc_photos/snack_bar_manager.dart';
import 'package:nc_photos/theme.dart';
import 'package:path/path.dart' as path;
mixin DirPickerMixin<T extends StatefulWidget> on State<T> {
@ -78,47 +77,42 @@ mixin DirPickerMixin<T extends StatefulWidget> on State<T> {
Widget _buildList(BuildContext context, LsDirBlocState state) {
final isTopLevel = _currentPath == getPickerRoot();
return Theme(
data: Theme.of(context).copyWith(
accentColor: AppTheme.getOverscrollIndicatorColor(context),
return AnimatedSwitcher(
duration: k.animationDurationNormal,
// see AnimatedSwitcher.defaultLayoutBuilder
layoutBuilder: (currentChild, previousChildren) => Stack(
children: <Widget>[
...previousChildren,
if (currentChild != null) currentChild,
],
alignment: Alignment.topLeft,
),
child: AnimatedSwitcher(
duration: k.animationDurationNormal,
// see AnimatedSwitcher.defaultLayoutBuilder
layoutBuilder: (currentChild, previousChildren) => Stack(
children: <Widget>[
...previousChildren,
if (currentChild != null) currentChild,
],
alignment: Alignment.topLeft,
),
child: ListView.separated(
key: Key(_currentPath),
itemBuilder: (context, index) {
if (!isTopLevel && index == 0) {
return ListTile(
dense: true,
leading: const SizedBox(width: 24),
title: Text(L10n.global().rootPickerNavigateUpItemText),
onTap: () {
try {
_navigateInto(File(path: path.dirname(_currentPath)));
} catch (e) {
SnackBarManager().showSnackBar(SnackBar(
content: Text(exception_util.toUserString(e)),
duration: k.snackBarDurationNormal,
));
}
},
);
} else {
return _buildItem(
context, state.items[index - (isTopLevel ? 0 : 1)]);
}
},
separatorBuilder: (context, index) => const Divider(),
itemCount: state.items.length + (isTopLevel ? 0 : 1),
),
child: ListView.separated(
key: Key(_currentPath),
itemBuilder: (context, index) {
if (!isTopLevel && index == 0) {
return ListTile(
dense: true,
leading: const SizedBox(width: 24),
title: Text(L10n.global().rootPickerNavigateUpItemText),
onTap: () {
try {
_navigateInto(File(path: path.dirname(_currentPath)));
} catch (e) {
SnackBarManager().showSnackBar(SnackBar(
content: Text(exception_util.toUserString(e)),
duration: k.snackBarDurationNormal,
));
}
},
);
} else {
return _buildItem(
context, state.items[index - (isTopLevel ? 0 : 1)]);
}
},
separatorBuilder: (context, index) => const Divider(),
itemCount: state.items.length + (isTopLevel ? 0 : 1),
),
);
}

View file

@ -226,7 +226,9 @@ class _DynamicAlbumBrowserState extends State<DynamicAlbumBrowser>
context,
child: Theme(
data: Theme.of(context).copyWith(
accentColor: AppTheme.getOverscrollIndicatorColor(context),
colorScheme: Theme.of(context).colorScheme.copyWith(
secondary: AppTheme.getOverscrollIndicatorColor(context),
),
),
child: CustomScrollView(
slivers: [

View file

@ -109,7 +109,9 @@ class _HomeAlbumsState extends State<HomeAlbums>
context,
child: Theme(
data: Theme.of(context).copyWith(
accentColor: AppTheme.getOverscrollIndicatorColor(context),
colorScheme: Theme.of(context).colorScheme.copyWith(
secondary: AppTheme.getOverscrollIndicatorColor(context),
),
),
child: CustomScrollView(
slivers: [

View file

@ -119,7 +119,9 @@ class _HomePhotosState extends State<HomePhotos>
context,
child: Theme(
data: Theme.of(context).copyWith(
accentColor: AppTheme.getOverscrollIndicatorColor(context),
colorScheme: Theme.of(context).colorScheme.copyWith(
secondary: AppTheme.getOverscrollIndicatorColor(context),
),
),
child: DraggableScrollbar.semicircle(
controller: _scrollController,

View file

@ -101,7 +101,9 @@ class _PendingAlbumsState extends State<PendingAlbums> {
children: [
Theme(
data: Theme.of(context).copyWith(
accentColor: AppTheme.getOverscrollIndicatorColor(context),
colorScheme: Theme.of(context).colorScheme.copyWith(
secondary: AppTheme.getOverscrollIndicatorColor(context),
),
),
child: CustomScrollView(
slivers: [

View file

@ -129,7 +129,9 @@ class _PeopleBrowserState extends State<PeopleBrowser> {
children: [
Theme(
data: Theme.of(context).copyWith(
accentColor: AppTheme.getOverscrollIndicatorColor(context),
colorScheme: Theme.of(context).colorScheme.copyWith(
secondary: AppTheme.getOverscrollIndicatorColor(context),
),
),
child: CustomScrollView(
slivers: [

View file

@ -128,7 +128,9 @@ class _PersonBrowserState extends State<PersonBrowser>
context,
child: Theme(
data: Theme.of(context).copyWith(
accentColor: AppTheme.getOverscrollIndicatorColor(context),
colorScheme: Theme.of(context).colorScheme.copyWith(
secondary: AppTheme.getOverscrollIndicatorColor(context),
),
),
child: CustomScrollView(
slivers: [

View file

@ -182,7 +182,7 @@ class _SettingsState extends State<Settings> {
child: Text(
label,
style: TextStyle(
color: Theme.of(context).accentColor,
color: Theme.of(context).colorScheme.secondary,
),
),
);

View file

@ -121,7 +121,9 @@ class _TrashbinBrowserState extends State<TrashbinBrowser>
context,
child: Theme(
data: Theme.of(context).copyWith(
accentColor: AppTheme.getOverscrollIndicatorColor(context),
colorScheme: Theme.of(context).colorScheme.copyWith(
secondary: AppTheme.getOverscrollIndicatorColor(context),
),
),
child: CustomScrollView(
slivers: [