Home > Mobile >  Flutter Slidable crashing
Flutter Slidable crashing

Time:07-13

I am new in flutter so I am trying to create a Slide in my list view to allow editing some info. I found a lib called flutter_slidable I am trying to use. The code was working well with dismissible component but I dont want itens dismissing, just sliding. When I changed the component for using Slidable, I started getting this error:


======== Exception caught by widgets library =======================================================
The following assertion was thrown building _SizeTransition(animation: AnimationController#89e25(⏮ 0.000; paused)➩Tween<double>(1.0 → 0.0)➩1.0, state: _AnimatedState#83664):
'package:flutter/src/widgets/basic.dart': Failed assertion: line 680 pos 12: 'clipBehavior != Clip.none': is not true.


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

The relevant error-causing widget was: 
  Slidable Slidable:file:///Users/ext.dimartinez/StudioProjects/delicias_do_boia/lib/listview_item_produto_widget.dart:15:12
When the exception was thrown, this was the stack: 
#2      ClipRect.createRenderObject (package:flutter/src/widgets/basic.dart:680:12)
#3      RenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5459:28)
#4      SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6122:11)
...     Normal element mounting (109 frames)
#113    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3631:14)
#114    Element.updateChild (package:flutter/src/widgets/framework.dart:3383:18)
#115    SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1243:37)
#116    SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1228:20)
#117    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2531:19)
#118    SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1221:12)
#119    RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:349:23)
#120    RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1962:59)
#121    PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:910:15)
#122    RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1962:14)
#123    RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:338:5)
#124    RenderSliverMultiBoxAdaptor.insertAndLayoutChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:484:5)
#125    RenderSliverList.performLayout.advance (package:flutter/src/rendering/sliver_list.dart:239:19)
#126    RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:281:12)
#127    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#128    RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:137:12)
#129    RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:371:11)
#130    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#131    RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:510:13)
#132    RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1580:12)
#133    RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1489:20)
#134    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#135    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#136    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#137    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#138    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#139    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#140    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#141    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#142    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#143    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#144    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#145    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#146    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#147    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#148    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#149    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#150    RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11)
#151    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#152    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#153    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#154    MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12)
#155    _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1005:7)
#156    MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
#157    RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:403:14)
#158    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#159    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#160    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#161    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#162    _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1376:11)
#163    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#164    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#165    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#166    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#167    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#168    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#169    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#170    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#171    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#172    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#173    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#174    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#175    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#176    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#177    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#178    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#179    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#180    RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3426:14)
#181    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#182    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#183    RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#184    _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:751:15)
#185    RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1707:7)
#186    PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:879:18)
#187    RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:497:19)
#188    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
#189    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:363:5)
#190    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1145:15)
#191    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#192    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)
#196    _invoke (dart:ui/hooks.dart:150:10)
#197    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5)
#198    _drawFrame (dart:ui/hooks.dart:114:31)
(elided 5 frames from class _AssertionError and dart:async)
====================================================================================================

the code:


import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
class ListItemProdutoWidget extends StatefulWidget {
  const ListItemProdutoWidget({Key? key}) : super(key: key);

  @override
  State<ListItemProdutoWidget> createState() => _ListItemProdutoWidgetState();
}

class _ListItemProdutoWidgetState extends State<ListItemProdutoWidget> {
  int i = 0;
  @override
  Widget build(BuildContext context) {
    return Slidable(
      endActionPane: ActionPane(motion: ScrollMotion(),
          children: [
            SlidableAction(
            // An action can be bigger than the others.
            flex: 2,
            onPressed: (context){},
            backgroundColor: Color(0xFF7BC043),
            foregroundColor: Colors.white,
            icon: Icons.archive,
            label: 'Archive',
          ),
          ],
      ),
     // key:Key("key${i  }" ),
      child:InkWell(
        onTap: (){print("InkWell");},
        child: Ink(
          height: 100,
          child: Card(
            elevation: 6,
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(12)
            ),
            child: Row(
              children: [
                Padding(padding: EdgeInsets.all(10.0),
                  child: Image.asset("images/delicias_do_boia.jpeg"),
                ),
                SizedBox(width: 10,),
                Expanded(child:
                Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text("Nome",
                      style:  TextStyle(
                          color: Colors.black,
                          fontSize: 14,
                          fontWeight: FontWeight.bold
                      ),
                    ),
                    SizedBox(height: 5,),
                    Text("descriçãoasdfadsfasdfasdfasdfasdfasdfasdfasdfasdfadsfadsfasd",
                      maxLines: 2,
                      style:  TextStyle(
                          color: Colors.black54,
                          fontSize: 10,
                          fontWeight: FontWeight.bold
                      ),
                    ),
                    Text("\R\$ 2.0",
                      style:  TextStyle(
                          color: Colors.red,
                          fontSize: 14,
                          fontWeight: FontWeight.bold
                      ),
                    ),
                  ],
                ))

              ],
            ),
          ),
        ),
      )
    );
  }
}

CodePudding user response:

I get the same error with the flutter_slidable package:

'clipBehavior != Clip.none': is not true.

and I just saw that there is an issue open with the library: https://github.com/letsar/flutter_slidable/issues/361

CodePudding user response:

downgrading to flutter_slidable: 1.3.0 solved the problem.

  • Related