mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-25 00:14:42 +01:00
Migrate deprecated code in flutter 3.16
This commit is contained in:
parent
65b66d306f
commit
302cc3938e
6 changed files with 76 additions and 76 deletions
|
@ -23,8 +23,8 @@ class ContentUriImage extends ImageProvider<ContentUriImage>
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ImageStreamCompleter loadBuffer(
|
ImageStreamCompleter loadImage(
|
||||||
ContentUriImage key, DecoderBufferCallback decode) {
|
ContentUriImage key, ImageDecoderCallback decode) {
|
||||||
return MultiFrameImageStreamCompleter(
|
return MultiFrameImageStreamCompleter(
|
||||||
codec: _loadAsync(key, decode),
|
codec: _loadAsync(key, decode),
|
||||||
scale: key.scale,
|
scale: key.scale,
|
||||||
|
@ -36,7 +36,7 @@ class ContentUriImage extends ImageProvider<ContentUriImage>
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<ui.Codec> _loadAsync(
|
Future<ui.Codec> _loadAsync(
|
||||||
ContentUriImage key, DecoderBufferCallback decode) async {
|
ContentUriImage key, ImageDecoderCallback decode) async {
|
||||||
assert(key == this);
|
assert(key == this);
|
||||||
final bytes = await ContentUri.readUri(uri);
|
final bytes = await ContentUri.readUri(uri);
|
||||||
if (bytes.lengthInBytes == 0) {
|
if (bytes.lengthInBytes == 0) {
|
||||||
|
|
|
@ -18,8 +18,8 @@ class DialogScaffold extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: WillPopScope(
|
child: PopScope(
|
||||||
onWillPop: () => Future.value(canPop),
|
canPop: canPop,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
|
|
|
@ -8,8 +8,8 @@ class ProcessingDialog extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
build(BuildContext context) {
|
build(BuildContext context) {
|
||||||
return WillPopScope(
|
return PopScope(
|
||||||
onWillPop: () => Future.value(false),
|
canPop: false,
|
||||||
child: AlertDialog(
|
child: AlertDialog(
|
||||||
content: Row(
|
content: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
|
|
@ -146,80 +146,81 @@ class _WrappedAccountSettingsState extends State<_WrappedAccountSettings>
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
child: WillPopScope(
|
child: _BlocSelector<bool>(
|
||||||
onWillPop: () async => !_bloc.state.shouldReload,
|
selector: (state) => state.shouldReload,
|
||||||
child: CustomScrollView(
|
builder: (_, shouldReload) => PopScope(
|
||||||
slivers: [
|
canPop: !shouldReload,
|
||||||
SliverAppBar(
|
child: CustomScrollView(
|
||||||
pinned: true,
|
slivers: [
|
||||||
title: Text(L10n.global().settingsAccountTitle),
|
SliverAppBar(
|
||||||
leading: _BlocSelector<bool>(
|
pinned: true,
|
||||||
selector: (state) => state.shouldReload,
|
title: Text(L10n.global().settingsAccountTitle),
|
||||||
builder: (_, state) =>
|
leading:
|
||||||
state ? const _DoneButton() : const BackButton(),
|
shouldReload ? const _DoneButton() : const BackButton(),
|
||||||
),
|
),
|
||||||
),
|
SliverList(
|
||||||
SliverList(
|
delegate: SliverChildListDelegate(
|
||||||
delegate: SliverChildListDelegate(
|
[
|
||||||
[
|
_BlocSelector<String?>(
|
||||||
_BlocSelector<String?>(
|
selector: (state) => state.label,
|
||||||
selector: (state) => state.label,
|
builder: (context, state) => ListTile(
|
||||||
builder: (context, state) => ListTile(
|
title: Text(L10n.global().settingsAccountLabelTitle),
|
||||||
title: Text(L10n.global().settingsAccountLabelTitle),
|
subtitle: Text(state ??
|
||||||
subtitle: Text(state ??
|
L10n.global().settingsAccountLabelDescription),
|
||||||
L10n.global().settingsAccountLabelDescription),
|
onTap: () => _onLabelPressed(context),
|
||||||
onTap: () => _onLabelPressed(context),
|
),
|
||||||
),
|
),
|
||||||
),
|
_BlocSelector<Account>(
|
||||||
_BlocSelector<Account>(
|
selector: (state) => state.account,
|
||||||
selector: (state) => state.account,
|
builder: (context, state) => ListTile(
|
||||||
builder: (context, state) => ListTile(
|
title:
|
||||||
title: Text(L10n.global().settingsIncludedFoldersTitle),
|
Text(L10n.global().settingsIncludedFoldersTitle),
|
||||||
subtitle:
|
subtitle:
|
||||||
Text(state.roots.map((e) => "/$e").join("; ")),
|
Text(state.roots.map((e) => "/$e").join("; ")),
|
||||||
onTap: () => _onIncludedFoldersPressed(context),
|
onTap: () => _onIncludedFoldersPressed(context),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
_BlocSelector<String>(
|
||||||
_BlocSelector<String>(
|
selector: (state) => state.shareFolder,
|
||||||
selector: (state) => state.shareFolder,
|
builder: (context, state) => ListTile(
|
||||||
builder: (context, state) => ListTile(
|
title: Text(L10n.global().settingsShareFolderTitle),
|
||||||
title: Text(L10n.global().settingsShareFolderTitle),
|
subtitle: Text("/$state"),
|
||||||
subtitle: Text("/$state"),
|
onTap: () => _onShareFolderPressed(context),
|
||||||
onTap: () => _onShareFolderPressed(context),
|
),
|
||||||
),
|
),
|
||||||
),
|
SettingsListCaption(
|
||||||
SettingsListCaption(
|
label: L10n.global().settingsServerAppSectionTitle,
|
||||||
label: L10n.global().settingsServerAppSectionTitle,
|
),
|
||||||
),
|
_BlocSelector<PersonProvider>(
|
||||||
_BlocSelector<PersonProvider>(
|
selector: (state) => state.personProvider,
|
||||||
selector: (state) => state.personProvider,
|
builder: (context, state) {
|
||||||
builder: (context, state) {
|
if (_bloc.highlight ==
|
||||||
if (_bloc.highlight ==
|
AccountSettingsOption.personProvider) {
|
||||||
AccountSettingsOption.personProvider) {
|
return AnimatedBuilder(
|
||||||
return AnimatedBuilder(
|
animation: _highlightAnimation,
|
||||||
animation: _highlightAnimation,
|
builder: (context, child) => ListTile(
|
||||||
builder: (context, child) => ListTile(
|
title: Text(
|
||||||
|
L10n.global().settingsPersonProviderTitle),
|
||||||
|
subtitle: Text(state.toUserString()),
|
||||||
|
onTap: () => _onPersonProviderPressed(context),
|
||||||
|
tileColor: _highlightAnimation.value,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
L10n.global().settingsPersonProviderTitle),
|
L10n.global().settingsPersonProviderTitle),
|
||||||
subtitle: Text(state.toUserString()),
|
subtitle: Text(state.toUserString()),
|
||||||
onTap: () => _onPersonProviderPressed(context),
|
onTap: () => _onPersonProviderPressed(context),
|
||||||
tileColor: _highlightAnimation.value,
|
);
|
||||||
),
|
}
|
||||||
);
|
},
|
||||||
} else {
|
),
|
||||||
return ListTile(
|
],
|
||||||
title:
|
),
|
||||||
Text(L10n.global().settingsPersonProviderTitle),
|
|
||||||
subtitle: Text(state.toUserString()),
|
|
||||||
onTap: () => _onPersonProviderPressed(context),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -70,8 +70,8 @@ class _SplashState extends State<Splash> {
|
||||||
@override
|
@override
|
||||||
build(BuildContext context) {
|
build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: WillPopScope(
|
body: PopScope(
|
||||||
onWillPop: () => Future.value(false),
|
canPop: false,
|
||||||
child: Builder(builder: (context) => _buildContent(context)),
|
child: Builder(builder: (context) => _buildContent(context)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -17,8 +17,7 @@ class PixelImage extends ImageProvider<PixelImage> {
|
||||||
SynchronousFuture<PixelImage>(this);
|
SynchronousFuture<PixelImage>(this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ImageStreamCompleter loadBuffer(
|
ImageStreamCompleter loadImage(PixelImage key, ImageDecoderCallback decode) =>
|
||||||
PixelImage key, DecoderBufferCallback decode) =>
|
|
||||||
OneFrameImageStreamCompleter(_createImageInfo());
|
OneFrameImageStreamCompleter(_createImageInfo());
|
||||||
|
|
||||||
Future<ImageInfo> _createImageInfo() async {
|
Future<ImageInfo> _createImageInfo() async {
|
||||||
|
|
Loading…
Add table
Reference in a new issue