fixed search icon visibility issue on different top bar states

This commit is contained in:
ashilkn 2022-08-23 19:19:54 +05:30
parent 44b17d1377
commit df76813c2d

View file

@ -60,13 +60,27 @@ class _StatusBarWidgetState extends State<StatusBarWidget> {
AnimatedOpacity( AnimatedOpacity(
opacity: _showStatus ? 0 : 1, opacity: _showStatus ? 0 : 1,
duration: const Duration(milliseconds: 1000), duration: const Duration(milliseconds: 1000),
child: const TopBarWidget(), child: const BrandingWidget(),
), ),
AnimatedOpacity( AnimatedOpacity(
opacity: _showStatus ? 1 : 0, opacity: _showStatus ? 1 : 0,
duration: const Duration(milliseconds: 1000), duration: const Duration(milliseconds: 1000),
child: const SyncStatusWidget(), child: const SyncStatusWidget(),
), ),
Positioned(
right: 0,
top: 0,
bottom: 0,
child: FeatureFlagService.instance.enableSearchFeature()
? Container(
color: Theme.of(context)
.colorScheme
.defaultBackgroundColor,
height: kContainerHeight,
child: const SearchIconWidget(),
)
: const SizedBox.shrink(),
),
], ],
), ),
AnimatedOpacity( AnimatedOpacity(
@ -118,7 +132,7 @@ class _SyncStatusWidgetState extends State<SyncStatusWidget> {
(DateTime.now().microsecondsSinceEpoch - _event.timestamp > (DateTime.now().microsecondsSinceEpoch - _event.timestamp >
kSleepDuration.inMicroseconds); kSleepDuration.inMicroseconds);
if (_event == null || isNotOutdatedEvent) { if (_event == null || isNotOutdatedEvent) {
return Container(); return const SizedBox.shrink();
} }
if (_event.status == SyncStatus.error) { if (_event.status == SyncStatus.error) {
return HeaderErrorWidget(error: _event.error); return HeaderErrorWidget(error: _event.error);
@ -206,13 +220,12 @@ class RefreshIndicatorWidget extends StatelessWidget {
} }
} }
class TopBarWidget extends StatelessWidget { class BrandingWidget extends StatelessWidget {
const TopBarWidget({Key key}) : super(key: key); const BrandingWidget({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
height: kContainerHeight, height: kContainerHeight,
@ -230,12 +243,6 @@ class TopBarWidget extends StatelessWidget {
), ),
), ),
), ),
FeatureFlagService.instance.enableSearchFeature()
? const SizedBox(
height: kContainerHeight,
child: SearchIconWidget(),
)
: const SizedBox.shrink()
], ],
); );
} }
@ -246,7 +253,8 @@ class SyncStatusCompletedWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return Container(
color: Theme.of(context).colorScheme.defaultBackgroundColor,
height: kContainerHeight, height: kContainerHeight,
child: Align( child: Align(
alignment: Alignment.center, alignment: Alignment.center,