Dn-a / flutter_inner_drawer

Inner Drawer is an easy way to create an internal side section (left/right) where you can insert a list-menu or other.
https://pub.dartlang.org/packages/flutter_inner_drawer
MIT License
514 stars 129 forks source link

Inner drawer with sliver #42

Closed uvlek closed 4 years ago

uvlek commented 4 years ago

Please help me to deal with this issue. When I use inner drawer with sliverlist - error happens

Code:

import 'package:flutter_inner_drawer/inner_drawer.dart';

class WhiteLayout extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return InnerDrawer(
      leftChild: Container(),
      rightChild: Container(),
      scaffold: Scaffold(
        body: CustomScrollView(
          slivers: <Widget>[
            SliverAppBar(
              expandedHeight: 200.0,
              flexibleSpace: const FlexibleSpaceBar(
                title: Text('Available seats'),
              ),
              actions: <Widget>[
                IconButton(
                  icon: const Icon(Icons.add_circle),
                  tooltip: 'Add new entry',
                  onPressed: () {},
                ),
              ],
            ),
            SliverToBoxAdapter(
              child: SizedBox(
                height: 600,
                child: Center(
                  child: Text('Main content here'),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

ERROR: `Performing hot restart... Syncing files to device Custom Phone preview... Restarted application in 2,062ms. I/flutter ( 2154): ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════ I/flutter ( 2154): The following assertion was thrown during a scheduler callback: I/flutter ( 2154): RenderBox was not laid out: RenderDecoratedBox#e8f57 NEEDS-LAYOUT NEEDS-PAINT I/flutter ( 2154): 'package:flutter/src/rendering/box.dart': I/flutter ( 2154): Failed assertion: line 1694 pos 12: 'hasSize' I/flutter ( 2154): I/flutter ( 2154): When the exception was thrown, this was the stack: I/flutter ( 2154): #2 RenderBox.size (package:flutter/src/rendering/box.dart:1694:12) I/flutter ( 2154): #3 InnerDrawerState._updateWidth. (package:flutter_inner_drawer/inner_drawer.dart:285:30) I/flutter ( 2154): #4 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15) I/flutter ( 2154): #5 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1060:9) I/flutter ( 2154): #6 SchedulerBinding.scheduleWarmUpFrame. (package:flutter/src/scheduler/binding.dart:861:7) I/flutter ( 2154): (elided 13 frames from class _AssertionError, class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch) I/flutter ( 2154): ════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by scheduler library ═════════════════════════════════════════════════════ The following assertion was thrown during a scheduler callback: RenderBox was not laid out: RenderDecoratedBox#e8f57 NEEDS-LAYOUT NEEDS-PAINT 'package:flutter/src/rendering/box.dart': Failed assertion: line 1694 pos 12: 'hasSize'

When the exception was thrown, this was the stack:

2 RenderBox.size (package:flutter/src/rendering/box.dart:1694:12)

3 InnerDrawerState._updateWidth. (package:flutter_inner_drawer/inner_drawer.dart:285:30)

4 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15)

5 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1060:9)

6 SchedulerBinding.scheduleWarmUpFrame. (package:flutter/src/scheduler/binding.dart:861:7)

... ════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by scheduler library ═════════════════════════════════════════════════════ RenderBox was not laid out: RenderDecoratedBox#e8f57 NEEDS-LAYOUT NEEDS-PAINT 'package:flutter/src/rendering/box.dart': Failed assertion: line 1694 pos 12: 'hasSize' ════════════════════════════════════════════════════════════════════════════════════════════════════ `

Dn-a commented 4 years ago

merged