Skip to content

LateInitializationError: Field 'mainAxisPosition' has not been initialized. #289

@tazik561

Description

@tazik561

I am using slidable 1.1.0 . I want to use custom ActionPane children like this:

return Slidable(
        closeOnScroll: false,
        startActionPane: ActionPane(
          motion: DrawerMotion(),
          extentRatio: 0.3,
          children: [
            SlidableAction(
              onPressed: (_) {},
              flex: 2,
              backgroundColor: Color(0xFF0392CF),
              foregroundColor: Colors.red,
              icon: Icons.save,
              label: 'Save',
              autoClose: true,
            ),
          ],
        ),
        endActionPane: ActionPane(
          motion: DrawerMotion(),
          children: [
            InkWell(
              onTap: () async {
              },
              child: Padding(
                padding: EdgeInsets.all(8),
                child: Container(
                  height: 80,
                  width: 80,
                  decoration: BoxDecoration(
                      color: Colors.white,
                      border: Border.all(color: colorGrayCCC, width: 1),
                      borderRadius: radius),
                  child: Padding(
                    padding: EdgeInsets.all(8),
                    child: Padding(
                      padding: const EdgeInsets.all(2.0),
                      child: Center(
                        child: Text(
                          "remove",
                          style: TextStyle(
                              fontSize: 13,
                              color: colorRed),
                        ),
                      ),
                    ),
                  ),
                ),
              ),
            )
          ],
        ),
        // The child of the Slidable is what the user sees when the
        // component is not dragged.
        child: MyCard(
          title: e.title,
          date: e.date,
          message: e.message,
          imageSVG: e.imageSVG,
          iconBackgroundColor: e.iconBackgroundColor,
        ),
      );

But When I swape my card I got this error:

════════ Exception caught by animation library ═════════════════════════════════
LateInitializationError: Field 'mainAxisPosition' has not been initialized.
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderClipRect#6def5
'package:flutter/src/rendering/box.dart':
package:flutter/…/rendering/box.dart:1
Failed assertion: line 1929 pos 12: 'hasSize'

The relevant error-causing widget was
Slidable

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions