Flutter教学

Flutter(84):Draggable组件之Draggabl

2020-11-25  本文已影响0人  starryxp

Flutter教学目录持续更新中

Github源代码持续更新中

1.DraggableScrollableSheetPage介绍

拖拽滚动布局,非常方便的实现的拖拽面板

2.DraggableScrollableSheetPage属性

3.DraggableScrollableNotification

4.使用

这里顺便填一下上一节的遗留问题DraggableScrollableNotification

      body: Stack(
        children: [
          Container(
            color: Colors.blue,
          ),
          NotificationListener<DraggableScrollableNotification>(
            onNotification: (notification) {
              print('####################');
              print('minExtent = ${notification.minExtent}');
              print('maxExtent = ${notification.maxExtent}');
              print('initialExtent = ${notification.initialExtent}');
              print('extent = ${notification.extent}');
              print('####################');
              return true;
            },
            child: DraggableScrollableSheet(
              builder: (
                BuildContext context,
                ScrollController scrollController,
              ) {
                return Container(
                  color: Colors.amber,
                  child: ListView.builder(
                    itemBuilder: (context, index) => ListTile(
                      title: Text('item $index'),
                    ),
                    itemCount: 30,
                    controller: scrollController,
                  ),
                );
              },
              initialChildSize: 0.8,
              minChildSize: 0.25,
              maxChildSize: 0.8,
              expand: true,
            ),
          )
        ],
      ),
image.png

下一节:Draggable组件之Draggable

Flutter(85):Draggable组件之Draggable

Flutter教学目录持续更新中

Github源代码持续更新中

上一篇 下一篇

猜你喜欢

热点阅读