diff --git a/example/lib/main.dart b/example/lib/main.dart index 76506f9..acbfae8 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -41,14 +41,18 @@ class _MyAppState extends State with SingleTickerProviderStateMixin { onPressed: doNothing, backgroundColor: Color(0xFFFE4A49), foregroundColor: Colors.white, - icon: Icons.delete, + icon: SizedBox( + child: Icon(Icons.delete), + ), label: 'Delete', ), SlidableAction( onPressed: doNothing, backgroundColor: Color(0xFF21B7CA), foregroundColor: Colors.white, - icon: Icons.share, + icon: SizedBox( + child: Icon(Icons.share), + ), label: 'Share', ), ], @@ -64,14 +68,18 @@ class _MyAppState extends State with SingleTickerProviderStateMixin { onPressed: (_) => controller.openEndActionPane(), backgroundColor: const Color(0xFF7BC043), foregroundColor: Colors.white, - icon: Icons.archive, + icon: SizedBox( + child: Icon(Icons.archive), + ), label: 'Archive', ), SlidableAction( onPressed: (_) => controller.close(), backgroundColor: const Color(0xFF0392CF), foregroundColor: Colors.white, - icon: Icons.save, + icon: SizedBox( + child: Icon(Icons.save), + ), label: 'Save', ), ], @@ -98,14 +106,18 @@ class _MyAppState extends State with SingleTickerProviderStateMixin { onPressed: doNothing, backgroundColor: Color(0xFFFE4A49), foregroundColor: Colors.white, - icon: Icons.delete, + icon: SizedBox( + child: Icon(Icons.delete), + ), label: 'Delete', ), SlidableAction( onPressed: doNothing, backgroundColor: Color(0xFF21B7CA), foregroundColor: Colors.white, - icon: Icons.share, + icon: SizedBox( + child: Icon(Icons.share), + ), label: 'Share', ), ], @@ -122,14 +134,18 @@ class _MyAppState extends State with SingleTickerProviderStateMixin { onPressed: doNothing, backgroundColor: Color(0xFF7BC043), foregroundColor: Colors.white, - icon: Icons.archive, + icon: SizedBox( + child: Icon(Icons.archive), + ), label: 'Archive', ), SlidableAction( onPressed: doNothing, backgroundColor: Color(0xFF0392CF), foregroundColor: Colors.white, - icon: Icons.save, + icon: SizedBox( + child: Icon(Icons.save), + ), label: 'Save', ), ], diff --git a/example/lib/main_demo.dart b/example/lib/main_demo.dart index afb1b97..7797be2 100644 --- a/example/lib/main_demo.dart +++ b/example/lib/main_demo.dart @@ -58,15 +58,32 @@ class _MyHomePageState extends State { closeThreshold: 0.4, motion: BehindMotion(), children: [ - SlideAction(color: Colors.green, icon: Icons.share), - SlideAction(color: Colors.amber, icon: Icons.delete), + SlideAction( + color: Colors.green, + icon: SizedBox( + child: Icon(Icons.share), + )), + SlideAction( + color: Colors.amber, + icon: SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: const ActionPane( motion: BehindMotion(), children: [ - SlideAction(color: Colors.red, icon: Icons.delete_forever), - SlideAction(color: Colors.blue, icon: Icons.alarm, flex: 2), + SlideAction( + color: Colors.red, + icon: SizedBox( + child: Icon(Icons.delete), + )), + SlideAction( + color: Colors.blue, + icon: SizedBox( + child: Icon(Icons.alarm), + ), + flex: 2), ], ), child: const Tile(color: Colors.grey, text: 'hello'), @@ -79,15 +96,32 @@ class _MyHomePageState extends State { startActionPane: const ActionPane( motion: StretchMotion(), children: [ - SlideAction(color: Colors.green, icon: Icons.share), - SlideAction(color: Colors.amber, icon: Icons.delete), + SlideAction( + color: Colors.green, + icon: SizedBox( + child: Icon(Icons.share), + )), + SlideAction( + color: Colors.amber, + icon: SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: const ActionPane( motion: StretchMotion(), children: [ - SlideAction(color: Colors.red, icon: Icons.delete_forever), - SlideAction(color: Colors.blue, icon: Icons.alarm, flex: 3), + SlideAction( + color: Colors.red, + icon: SizedBox( + child: Icon(Icons.delete), + )), + SlideAction( + color: Colors.blue, + icon: SizedBox( + child: Icon(Icons.alarm), + ), + flex: 3), ], ), child: const Tile(color: Colors.pink, text: 'hello 2'), @@ -98,15 +132,32 @@ class _MyHomePageState extends State { startActionPane: const ActionPane( motion: ScrollMotion(), children: [ - SlideAction(color: Colors.green, icon: Icons.share), - SlideAction(color: Colors.amber, icon: Icons.delete), + SlideAction( + color: Colors.green, + icon: SizedBox( + child: Icon(Icons.share), + )), + SlideAction( + color: Colors.amber, + icon: SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: const ActionPane( motion: ScrollMotion(), children: [ - SlideAction(color: Colors.red, icon: Icons.delete_forever), - SlideAction(color: Colors.blue, icon: Icons.alarm, flex: 2), + SlideAction( + color: Colors.red, + icon: SizedBox( + child: Icon(Icons.delete), + )), + SlideAction( + color: Colors.blue, + icon: SizedBox( + child: Icon(Icons.alarm), + ), + flex: 2), ], ), child: const Tile(color: Colors.yellow, text: 'hello 3'), @@ -152,15 +203,32 @@ class _MyHomePageState extends State { }, ), children: const [ - SlideAction(color: Colors.green, icon: Icons.share), - SlideAction(color: Colors.amber, icon: Icons.delete), + SlideAction( + color: Colors.green, + icon: SizedBox( + child: Icon(Icons.share), + )), + SlideAction( + color: Colors.amber, + icon: SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: const ActionPane( motion: DrawerMotion(), children: [ - SlideAction(color: Colors.red, icon: Icons.delete_forever), - SlideAction(color: Colors.blue, icon: Icons.alarm, flex: 2), + SlideAction( + color: Colors.red, + icon: SizedBox( + child: Icon(Icons.delete), + )), + SlideAction( + color: Colors.blue, + icon: SizedBox( + child: Icon(Icons.alarm), + ), + flex: 2), ], ), child: const Tile(color: Colors.lime, text: 'hello 4'), @@ -171,15 +239,32 @@ class _MyHomePageState extends State { startActionPane: const ActionPane( motion: BehindMotion(), children: [ - SlideAction(color: Colors.green, icon: Icons.share), - SlideAction(color: Colors.amber, icon: Icons.delete), + SlideAction( + color: Colors.green, + icon: SizedBox( + child: Icon(Icons.share), + )), + SlideAction( + color: Colors.amber, + icon: SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: const ActionPane( motion: BehindMotion(), children: [ - SlideAction(color: Colors.red, icon: Icons.delete_forever), - SlideAction(color: Colors.blue, icon: Icons.alarm, flex: 2), + SlideAction( + color: Colors.red, + icon: SizedBox( + child: Icon(Icons.delete), + )), + SlideAction( + color: Colors.blue, + icon: SizedBox( + child: Icon(Icons.alarm), + ), + flex: 2), ], ), child: const Tile(color: Colors.grey, text: 'hello'), @@ -190,15 +275,32 @@ class _MyHomePageState extends State { startActionPane: const ActionPane( motion: BehindMotion(), children: [ - SlideAction(color: Colors.green, icon: Icons.share), - SlideAction(color: Colors.amber, icon: Icons.delete), + SlideAction( + color: Colors.green, + icon: SizedBox( + child: Icon(Icons.share), + )), + SlideAction( + color: Colors.amber, + icon: SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: const ActionPane( motion: BehindMotion(), children: [ - SlideAction(color: Colors.red, icon: Icons.delete_forever), - SlideAction(color: Colors.blue, icon: Icons.alarm, flex: 2), + SlideAction( + color: Colors.red, + icon: SizedBox( + child: Icon(Icons.delete), + )), + SlideAction( + color: Colors.blue, + icon: SizedBox( + child: Icon(Icons.alarm), + ), + flex: 2), ], ), child: const Tile(color: Colors.grey, text: 'hello'), @@ -209,15 +311,32 @@ class _MyHomePageState extends State { startActionPane: const ActionPane( motion: BehindMotion(), children: [ - SlideAction(color: Colors.green, icon: Icons.share), - SlideAction(color: Colors.amber, icon: Icons.delete), + SlideAction( + color: Colors.green, + icon: SizedBox( + child: Icon(Icons.share), + )), + SlideAction( + color: Colors.amber, + icon: SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: const ActionPane( motion: BehindMotion(), children: [ - SlideAction(color: Colors.red, icon: Icons.delete_forever), - SlideAction(color: Colors.blue, icon: Icons.alarm, flex: 2), + SlideAction( + color: Colors.red, + icon: SizedBox( + child: Icon(Icons.delete), + )), + SlideAction( + color: Colors.blue, + icon: SizedBox( + child: Icon(Icons.alarm), + ), + flex: 2), ], ), child: const Tile(color: Colors.grey, text: 'hello'), @@ -228,15 +347,32 @@ class _MyHomePageState extends State { startActionPane: const ActionPane( motion: BehindMotion(), children: [ - SlideAction(color: Colors.green, icon: Icons.share), - SlideAction(color: Colors.amber, icon: Icons.delete), + SlideAction( + color: Colors.green, + icon: SizedBox( + child: Icon(Icons.share), + )), + SlideAction( + color: Colors.amber, + icon: SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: const ActionPane( motion: BehindMotion(), children: [ - SlideAction(color: Colors.red, icon: Icons.delete_forever), - SlideAction(color: Colors.blue, icon: Icons.alarm, flex: 2), + SlideAction( + color: Colors.red, + icon: SizedBox( + child: Icon(Icons.delete), + )), + SlideAction( + color: Colors.blue, + icon: SizedBox( + child: Icon(Icons.alarm), + ), + flex: 2), ], ), child: const Tile(color: Colors.grey, text: 'hello'), @@ -257,7 +393,7 @@ class SlideAction extends StatelessWidget { }) : super(key: key); final Color color; - final IconData icon; + final Widget icon; final int flex; @override @@ -291,7 +427,7 @@ class Tile extends StatelessWidget { return ActionTypeListener( child: GestureDetector( onTap: () { - print('$text'); + print(text); }, onLongPress: () => Slidable.of(context)!.openEndActionPane(), child: Container( diff --git a/example/lib/main_example.dart b/example/lib/main_example.dart index c782adf..bb785e6 100644 --- a/example/lib/main_example.dart +++ b/example/lib/main_example.dart @@ -10,12 +10,16 @@ void main() { const actions = [ SlideAction( color: Color(0xFFFE4A49), - icon: Icons.delete, + icon: SizedBox( + child: Icon(Icons.delete), + ), label: 'Delete', ), SlideAction( color: Color(0xFF21B7CA), - icon: Icons.share, + icon: SizedBox( + child: Icon(Icons.share), + ), label: 'Share', ), ]; @@ -207,7 +211,7 @@ class SlideAction extends StatelessWidget { }) : super(key: key); final Color color; - final IconData icon; + final Widget icon; final int flex; final String label; diff --git a/example/lib/main_outside_list.dart b/example/lib/main_outside_list.dart index cc5ede9..b2e0558 100644 --- a/example/lib/main_outside_list.dart +++ b/example/lib/main_outside_list.dart @@ -56,17 +56,32 @@ class _MyHomePageState extends State { closeThreshold: 0.4, motion: BehindMotion(), children: [ - SlideAction(color: Colors.green, icon: Icons.share), - SlideAction(color: Colors.amber, icon: Icons.delete), + SlideAction( + color: Colors.green, + icon: SizedBox( + child: Icon(Icons.share), + )), + SlideAction( + color: Colors.amber, + icon: SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: const ActionPane( motion: BehindMotion(), children: [ SlideAction( - color: Colors.red, icon: Icons.delete_forever), + color: Colors.red, + icon: SizedBox( + child: Icon(Icons.delete), + )), SlideAction( - color: Colors.blue, icon: Icons.alarm, flex: 2), + color: Colors.blue, + icon: SizedBox( + child: Icon(Icons.alarm), + ), + flex: 2), ], ), child: const Tile(color: Colors.grey, text: 'hello'), @@ -81,15 +96,32 @@ class _MyHomePageState extends State { startActionPane: const ActionPane( motion: StretchMotion(), children: [ - SlideAction(color: Colors.green, icon: Icons.share), - SlideAction(color: Colors.amber, icon: Icons.delete), + SlideAction( + color: Colors.green, + icon: SizedBox( + child: Icon(Icons.share), + )), + SlideAction( + color: Colors.amber, + icon: SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: const ActionPane( motion: StretchMotion(), children: [ - SlideAction(color: Colors.red, icon: Icons.delete_forever), - SlideAction(color: Colors.blue, icon: Icons.alarm, flex: 3), + SlideAction( + color: Colors.red, + icon: SizedBox( + child: Icon(Icons.delete), + )), + SlideAction( + color: Colors.blue, + icon: SizedBox( + child: Icon(Icons.alarm), + ), + flex: 3), ], ), child: const Tile(color: Colors.pink, text: 'hello 2'), @@ -102,15 +134,32 @@ class _MyHomePageState extends State { startActionPane: const ActionPane( motion: ScrollMotion(), children: [ - SlideAction(color: Colors.green, icon: Icons.share), - SlideAction(color: Colors.amber, icon: Icons.delete), + SlideAction( + color: Colors.green, + icon: SizedBox( + child: Icon(Icons.share), + )), + SlideAction( + color: Colors.amber, + icon: SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: const ActionPane( motion: ScrollMotion(), children: [ - SlideAction(color: Colors.red, icon: Icons.delete_forever), - SlideAction(color: Colors.blue, icon: Icons.alarm, flex: 2), + SlideAction( + color: Colors.red, + icon: SizedBox( + child: Icon(Icons.delete), + )), + SlideAction( + color: Colors.blue, + icon: SizedBox( + child: Icon(Icons.alarm), + ), + flex: 2), ], ), child: const Tile(color: Colors.yellow, text: 'hello 3'), @@ -160,17 +209,32 @@ class _MyHomePageState extends State { }, ), children: const [ - SlideAction(color: Colors.green, icon: Icons.share), - SlideAction(color: Colors.amber, icon: Icons.delete), + SlideAction( + color: Colors.green, + icon: SizedBox( + child: Icon(Icons.share), + )), + SlideAction( + color: Colors.amber, + icon: SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: const ActionPane( motion: DrawerMotion(), children: [ SlideAction( - color: Colors.red, icon: Icons.delete_forever), + color: Colors.red, + icon: SizedBox( + child: Icon(Icons.delete), + )), SlideAction( - color: Colors.blue, icon: Icons.alarm, flex: 2), + color: Colors.blue, + icon: SizedBox( + child: Icon(Icons.alarm), + ), + flex: 2), ], ), child: const Tile(color: Colors.lime, text: 'hello 4'), @@ -192,7 +256,7 @@ class SlideAction extends StatelessWidget { }) : super(key: key); final Color color; - final IconData icon; + final Widget icon; final int flex; @override diff --git a/lib/src/actions.dart b/lib/src/actions.dart index 91140e8..2b225ef 100644 --- a/lib/src/actions.dart +++ b/lib/src/actions.dart @@ -96,6 +96,7 @@ class CustomSlidableAction extends StatelessWidget { child: OutlinedButton( onPressed: () => _handleTap(context), style: OutlinedButton.styleFrom( + foregroundColor: effectiveForegroundColor, padding: padding, backgroundColor: backgroundColor, disabledForegroundColor: effectiveForegroundColor.withValues( @@ -103,6 +104,7 @@ class CustomSlidableAction extends StatelessWidget { ), iconColor: effectiveForegroundColor, foregroundColor: effectiveForegroundColor, + shape: RoundedRectangleBorder( borderRadius: borderRadius, ), @@ -139,7 +141,7 @@ class SlidableAction extends StatelessWidget { this.foregroundColor, this.autoClose = _kAutoClose, required this.onPressed, - this.icon, + required this.icon, this.spacing = 4, this.label, this.borderRadius = BorderRadius.zero, @@ -163,7 +165,7 @@ class SlidableAction extends StatelessWidget { final SlidableActionCallback? onPressed; /// An icon to display above the [label]. - final IconData? icon; + final Widget icon; /// The space between [icon] and [label] if both set. /// @@ -183,11 +185,7 @@ class SlidableAction extends StatelessWidget { Widget build(BuildContext context) { final children = []; - if (icon != null) { - children.add( - Icon(icon), - ); - } + children.add(icon); if (label != null) { if (children.isNotEmpty) { diff --git a/test/actions_test.dart b/test/actions_test.dart index 745a17a..f439b22 100644 --- a/test/actions_test.dart +++ b/test/actions_test.dart @@ -37,6 +37,7 @@ void main() { child: Row( children: [ SlidableAction( + icon: const Icon(Icons.save), onPressed: (_) => logs.add('pressed'), label: 'label', ) @@ -60,6 +61,7 @@ void main() { child: Row( children: [ SlidableAction( + icon: const Icon(Icons.save), onPressed: (_) => logs.add('pressed'), label: 'my_label', ) @@ -80,7 +82,7 @@ void main() { children: [ SlidableAction( onPressed: (_) => logs.add('pressed'), - icon: Icons.ac_unit, + icon: Container(), ) ], ), @@ -99,7 +101,7 @@ void main() { children: [ SlidableAction( onPressed: (_) => logs.add('pressed'), - icon: Icons.ac_unit, + icon: Container(), label: 'my_label', ) ], diff --git a/test/dismissible_pane_test.dart b/test/dismissible_pane_test.dart index 1bd9dcd..96b2d88 100644 --- a/test/dismissible_pane_test.dart +++ b/test/dismissible_pane_test.dart @@ -33,8 +33,16 @@ void main() { ), motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), ], ), child: const SizedBox.expand(), @@ -76,8 +84,16 @@ void main() { ), motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), child: const SizedBox.expand(), @@ -123,8 +139,16 @@ void main() { ), motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), child: const SizedBox.expand(), @@ -173,8 +197,16 @@ void main() { ), motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), child: const SizedBox.expand(), @@ -225,8 +257,16 @@ void main() { ), motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), child: const SizedBox.expand(), @@ -281,8 +321,16 @@ void main() { ), motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), child: const SizedBox.expand(), @@ -339,8 +387,16 @@ void main() { ), motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), child: Builder( diff --git a/test/slidable_test.dart b/test/slidable_test.dart index 73a0319..eb1813f 100644 --- a/test/slidable_test.dart +++ b/test/slidable_test.dart @@ -20,16 +20,32 @@ void main() { key: startActionPaneKey, motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: ActionPane( key: endActionPaneKey, motion: const ScrollMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), child: Builder(builder: (context) { @@ -67,16 +83,32 @@ void main() { key: startActionPaneKey, motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: ActionPane( key: endActionPaneKey, motion: const ScrollMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), child: Builder(builder: (context) { @@ -115,16 +147,32 @@ void main() { key: startActionPaneKey, motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: ActionPane( key: endActionPaneKey, motion: const ScrollMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), child: Builder(builder: (context) { @@ -163,16 +211,32 @@ void main() { key: startActionPaneKey, motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), endActionPane: ActionPane( key: endActionPaneKey, motion: const ScrollMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), child: Builder(builder: (context) { @@ -212,8 +276,16 @@ void main() { key: endActionPaneKey, motion: const ScrollMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), child: Builder( @@ -252,8 +324,16 @@ void main() { key: startActionPaneKey, motion: const ScrollMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ), child: Builder( @@ -287,8 +367,16 @@ void main() { key: actionPaneKey, motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], ); @@ -325,8 +413,16 @@ void main() { key: actionPaneKey, motion: const BehindMotion(), children: [ - SlidableAction(onPressed: (_) {}, icon: Icons.share), - SlidableAction(onPressed: (_) {}, icon: Icons.delete), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.share), + )), + SlidableAction( + onPressed: (_) {}, + icon: const SizedBox( + child: Icon(Icons.delete), + )), ], );