Workaround IconButton splash animation appearing on the back

Workaround for https://github.com/flutter/flutter/issues/30658

Fixes #460
This commit is contained in:
Vishesh Handa
2021-11-09 15:54:58 +01:00
parent a149371a44
commit df543d38f2
3 changed files with 15 additions and 9 deletions

View File

@ -96,7 +96,8 @@ class EditorBottomBar extends StatelessWidget {
child: Row(
children: <Widget>[
Visibility(
child: addIcon,
// Remove Material when https://github.com/flutter/flutter/issues/30658 is fixed
child: Material(child: addIcon),
visible: allowEdits,
maintainSize: true,
maintainAnimation: true,
@ -126,7 +127,8 @@ class EditorBottomBar extends StatelessWidget {
onPressed: redoAllowed ? onRedoSelected : null,
),
const Spacer(),
menuIcon,
// Remove Material when https://github.com/flutter/flutter/issues/30658 is fixed
Material(child: menuIcon),
],
mainAxisAlignment: MainAxisAlignment.center,
),

View File

@ -34,32 +34,32 @@ class MarkdownToolBar extends StatelessWidget {
scrollDirection: Axis.horizontal,
child: Row(
children: [
IconButton(
fork.IconButton(
icon: Text('H1', style: style),
padding: const EdgeInsets.all(0.0),
onPressed: () => _modifyCurrentLine('# '),
),
IconButton(
fork.IconButton(
icon: Text('I', style: style),
padding: const EdgeInsets.all(0.0),
onPressed: () => _modifyCurrentWord('*'),
),
IconButton(
fork.IconButton(
icon: Text('B', style: style),
padding: const EdgeInsets.all(0.0),
onPressed: () => _modifyCurrentWord('**'),
),
IconButton(
fork.IconButton(
icon: const FaIcon(FontAwesomeIcons.listUl),
padding: const EdgeInsets.all(0.0),
onPressed: () => _modifyCurrentLine('- '),
),
IconButton(
fork.IconButton(
icon: const FaIcon(FontAwesomeIcons.listOl),
padding: const EdgeInsets.all(0.0),
onPressed: () => _modifyCurrentLine('1. '),
),
IconButton(
fork.IconButton(
icon: const FaIcon(FontAwesomeIcons.tasks),
padding: const EdgeInsets.all(0.0),
onPressed: () => _modifyCurrentLine('- [ ] '),

View File

@ -21,6 +21,9 @@ const double _kMinButtonSize = kMinInteractiveDimension;
/// A material design icon button.
///
/// The FORK adds onLongPressed and wraps it in Material because of
/// https://github.com/flutter/flutter/issues/30658
///
/// An icon button is a picture printed on a [Material] widget that reacts to
/// touches by filling with color (ink).
///
@ -374,7 +377,7 @@ class IconButton extends StatelessWidget {
);
}
return Semantics(
var sem = Semantics(
button: true,
enabled: onPressed != null,
child: InkResponse(
@ -398,6 +401,7 @@ class IconButton extends StatelessWidget {
),
),
);
return Material(child: sem);
}
@override