fixed flashing app bar during hero in some cases

This commit is contained in:
Thibault Deckers 2022-05-25 12:07:44 +09:00
parent 3c90ef312a
commit 56b865af13

View file

@ -2,6 +2,7 @@ import 'package:aves/model/settings/settings.dart';
import 'package:aves/theme/durations.dart';
import 'package:aves/widgets/aves_app.dart';
import 'package:aves/widgets/common/fx/blurred.dart';
import 'package:aves/widgets/common/providers/query_provider.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@ -100,23 +101,26 @@ class AvesAppBar extends StatelessWidget {
final pushing = direction == HeroFlightDirection.push;
Widget popBuilder(context, child) => Opacity(opacity: 1 - animation.value, child: child);
Widget pushBuilder(context, child) => Opacity(opacity: animation.value, child: child);
return Material(
type: MaterialType.transparency,
child: DefaultTextStyle(
style: DefaultTextStyle.of(toHero).style,
child: Stack(
children: [
AnimatedBuilder(
animation: animation,
builder: pushing ? popBuilder : pushBuilder,
child: fromHero.widget,
),
AnimatedBuilder(
animation: animation,
builder: pushing ? pushBuilder : popBuilder,
child: toHero.widget,
),
],
return QueryProvider(
initialQuery: null,
child: Material(
type: MaterialType.transparency,
child: DefaultTextStyle(
style: DefaultTextStyle.of(toHero).style,
child: Stack(
children: [
AnimatedBuilder(
animation: animation,
builder: pushing ? popBuilder : pushBuilder,
child: fromHero.widget,
),
AnimatedBuilder(
animation: animation,
builder: pushing ? pushBuilder : popBuilder,
child: toHero.widget,
),
],
),
),
),
);