flutter_slidable icon indicating copy to clipboard operation
flutter_slidable copied to clipboard

Fixed RTL direction for the dismissible using fromStart attribute

Open hassanannajjar opened this issue 3 years ago • 8 comments

Problem:

Before

https://user-images.githubusercontent.com/49004640/168809636-f12c9799-328f-42a0-aa00-450b1eb4318a.mov

Solution:

I just added a new attribute called fromStart to change the dismissible direction

After

https://user-images.githubusercontent.com/49004640/168814751-f2f31918-01c9-4ce3-abd3-d7073c5e3137.mov

hassanannajjar avatar May 17 '22 12:05 hassanannajjar

@letsar can you check this, plz

ibrahimdeeb0 avatar May 19 '22 19:05 ibrahimdeeb0

I'm not sure that how we should fix the issue. Can you send me a repro example I could just run to see what we can see?

letsar avatar May 22 '22 07:05 letsar

I'm not sure that how we should fix the issue. Can you send me a repro example I could just run to see what we can see?

Hi, and sorry for the late response

The problem happen when you use Directionality textDirection: TextDirection.rtl as parent for Slidable, Then ActionPane direction does not work from start to end and end to start

  • you can try this
Directionality(
             textDirection: TextDirection.rtl,
             child: Slidable(
               // Specify a key if the Slidable is dismissible.
               key: const ValueKey(0),

               // The start action pane is the one at the left or the top side.
               startActionPane: ActionPane(
                 // A motion is a widget used to control how the pane animates.
                 motion: const ScrollMotion(),

                 // A pane can dismiss the Slidable.
                 dismissible: DismissiblePane(onDismissed: () {}),

                 // All actions are defined in the children parameter.
                 children: const [
                   // A SlidableAction can have an icon and/or a label.
                   SlidableAction(
                     onPressed: doNothing,
                     backgroundColor: Color(0xFFFE4A49),
                     foregroundColor: Colors.white,
                     icon: Icons.delete,
                     label: 'Delete',
                   ),
                   SlidableAction(
                     onPressed: doNothing,
                     backgroundColor: Color(0xFF21B7CA),
                     foregroundColor: Colors.white,
                     icon: Icons.share,
                     label: 'Share',
                   ),
                 ],
               ),

               // The end action pane is the one at the right or the bottom side.
               endActionPane: ActionPane(
                 motion: const ScrollMotion(),
                 dismissible: DismissiblePane(
                   onDismissed: () {},
                   confirmDismiss: () => Future.value(false),
                 ),
                 children: const [
                   SlidableAction(
                     // An action can be bigger than the others.
                     flex: 2,
                     onPressed: doNothing,
                     backgroundColor: Color(0xFF7BC043),
                     foregroundColor: Colors.white,
                     icon: Icons.archive,
                     label: 'Archive',
                   ),
                 ],
               ),

               // The child of the Slidable is what the user sees when the
               // component is not dragged.
               child: const ListTile(title: Text('Slide me')),
             ),
           ),
  • or check the example in the same repo I changed

hassanannajjar avatar Jun 29 '22 05:06 hassanannajjar

Any update on this issue?

saad-01 avatar May 08 '24 13:05 saad-01

@letsar how to solve this bug?

saad-01 avatar May 09 '24 07:05 saad-01