From 76ff8ef690e8e21177b456a321ab73e15b2a7b27 Mon Sep 17 00:00:00 2001 From: Philip Brink Date: Thu, 4 Aug 2022 11:26:31 -0400 Subject: [PATCH] Make analyzer happy --- example/lib/basic_example.dart | 14 ++++----- example/lib/drag_handle_example.dart | 32 +++++++++---------- example/lib/drag_into_list_example.dart | 38 +++++++++++------------ example/lib/expansion_tile_example.dart | 17 +++++----- example/lib/fixed_example.dart | 14 ++++----- example/lib/horizontal_example.dart | 28 ++++++++--------- example/lib/list_tile_example.dart | 34 ++++++++++---------- example/lib/main.dart | 20 ++++++------ example/lib/navigation_drawer.dart | 35 +++++++++++---------- example/lib/sliver_example.dart | 16 +++++----- lib/drag_and_drop_builder_parameters.dart | 3 -- lib/drag_and_drop_item.dart | 2 +- lib/drag_and_drop_item_target.dart | 1 - lib/drag_and_drop_item_wrapper.dart | 4 --- lib/drag_and_drop_list_expansion.dart | 1 - lib/drag_and_drop_list_wrapper.dart | 2 -- lib/programmatic_expansion_tile.dart | 1 - 17 files changed, 118 insertions(+), 144 deletions(-) diff --git a/example/lib/basic_example.dart b/example/lib/basic_example.dart index 6332c19..ed48ed2 100644 --- a/example/lib/basic_example.dart +++ b/example/lib/basic_example.dart @@ -1,14 +1,12 @@ -import 'package:drag_and_drop_lists/drag_and_drop_item.dart'; import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; import 'package:example/navigation_drawer.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; class BasicExample extends StatefulWidget { - BasicExample({Key? key}) : super(key: key); + const BasicExample({Key? key}) : super(key: key); @override - _BasicExample createState() => _BasicExample(); + State createState() => _BasicExample(); } class _BasicExample extends State { @@ -22,7 +20,7 @@ class _BasicExample extends State { return DragAndDropList( header: Row( children: [ - Expanded( + const Expanded( flex: 1, child: Divider(), ), @@ -30,7 +28,7 @@ class _BasicExample extends State { padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), child: Text('Header $index'), ), - Expanded( + const Expanded( flex: 1, child: Divider(), ), @@ -55,9 +53,9 @@ class _BasicExample extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Basic'), + title: const Text('Basic'), ), - drawer: NavigationDrawer(), + drawer: const NavigationDrawer(), body: DragAndDropLists( children: _contents, onItemReorder: _onItemReorder, diff --git a/example/lib/drag_handle_example.dart b/example/lib/drag_handle_example.dart index 177f615..f666bcc 100644 --- a/example/lib/drag_handle_example.dart +++ b/example/lib/drag_handle_example.dart @@ -1,14 +1,12 @@ import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; import 'package:example/navigation_drawer.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/widgets.dart'; class DragHandleExample extends StatefulWidget { - DragHandleExample({Key? key}) : super(key: key); + const DragHandleExample({Key? key}) : super(key: key); @override - _DragHandleExample createState() => _DragHandleExample(); + State createState() => _DragHandleExample(); } class _DragHandleExample extends State { @@ -25,10 +23,10 @@ class _DragHandleExample extends State { Row( children: [ Padding( - padding: EdgeInsets.only(left: 8, bottom: 4), + padding: const EdgeInsets.only(left: 8, bottom: 4), child: Text( 'Header $index', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16), + style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16), ), ), ], @@ -40,7 +38,7 @@ class _DragHandleExample extends State { child: Row( children: [ Padding( - padding: EdgeInsets.symmetric(vertical: 8, horizontal: 12), + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), child: Text( 'Sub $index.1', ), @@ -52,7 +50,7 @@ class _DragHandleExample extends State { child: Row( children: [ Padding( - padding: EdgeInsets.symmetric(vertical: 8, horizontal: 12), + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), child: Text( 'Sub $index.2', ), @@ -64,7 +62,7 @@ class _DragHandleExample extends State { child: Row( children: [ Padding( - padding: EdgeInsets.symmetric(vertical: 8, horizontal: 12), + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), child: Text( 'Sub $index.3', ), @@ -79,19 +77,19 @@ class _DragHandleExample extends State { @override Widget build(BuildContext context) { - var backgroundColor = Color.fromARGB(255, 243, 242, 248); + var backgroundColor = const Color.fromARGB(255, 243, 242, 248); return Scaffold( backgroundColor: backgroundColor, appBar: AppBar( - title: Text('Drag Handle'), + title: const Text('Drag Handle'), ), - drawer: NavigationDrawer(), + drawer: const NavigationDrawer(), body: DragAndDropLists( children: _contents, onItemReorder: _onItemReorder, onListReorder: _onListReorder, - listPadding: EdgeInsets.symmetric(horizontal: 15, vertical: 10), + listPadding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10), itemDivider: Divider( thickness: 2, height: 2, @@ -104,18 +102,18 @@ class _DragHandleExample extends State { color: Colors.grey.withOpacity(0.5), spreadRadius: 2, blurRadius: 3, - offset: Offset(0, 0), // changes position of shadow + offset: const Offset(0, 0), // changes position of shadow ), ], ), listInnerDecoration: BoxDecoration( color: Theme.of(context).canvasColor, - borderRadius: BorderRadius.all(Radius.circular(8.0)), + borderRadius: const BorderRadius.all(Radius.circular(8.0)), ), lastItemTargetHeight: 8, addLastItemTargetHeightToTop: true, lastListTargetSize: 40, - listDragHandle: DragHandle( + listDragHandle: const DragHandle( verticalAlignment: DragHandleVerticalAlignment.top, child: Padding( padding: EdgeInsets.only(right: 10), @@ -125,7 +123,7 @@ class _DragHandleExample extends State { ), ), ), - itemDragHandle: DragHandle( + itemDragHandle: const DragHandle( child: Padding( padding: EdgeInsets.only(right: 10), child: Icon( diff --git a/example/lib/drag_into_list_example.dart b/example/lib/drag_into_list_example.dart index be76871..aec1e19 100644 --- a/example/lib/drag_into_list_example.dart +++ b/example/lib/drag_into_list_example.dart @@ -1,27 +1,25 @@ -import 'package:drag_and_drop_lists/drag_and_drop_item.dart'; import 'package:drag_and_drop_lists/drag_and_drop_list_interface.dart'; import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; import 'package:example/navigation_drawer.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; class DragIntoListExample extends StatefulWidget { - DragIntoListExample({Key? key}) : super(key: key); + const DragIntoListExample({Key? key}) : super(key: key); @override - _DragIntoListExample createState() => _DragIntoListExample(); + State createState() => _DragIntoListExample(); } class _DragIntoListExample extends State { - List _contents = []; + final List _contents = []; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Drag Into List'), + title: const Text('Drag Into List'), ), - drawer: NavigationDrawer(), + drawer: const NavigationDrawer(), body: Column( children: [ Flexible( @@ -32,7 +30,7 @@ class _DragIntoListExample extends State { onListReorder: _onListReorder, onItemAdd: _onItemAdd, onListAdd: _onListAdd, - listGhost: Container( + listGhost: const SizedBox( height: 50, width: 100, child: Center( @@ -51,14 +49,14 @@ class _DragIntoListExample extends State { color: Colors.pink, child: Center( child: Draggable( - feedback: Icon(Icons.assignment), - child: Icon(Icons.assignment), + feedback: const Icon(Icons.assignment), data: DragAndDropList( - header: Text( + header: const Text( 'New default list', ), children: [], ), + child: const Icon(Icons.assignment), ), ), ), @@ -68,9 +66,9 @@ class _DragIntoListExample extends State { color: Colors.orange, child: Center( child: Draggable( - feedback: Icon(Icons.photo), - child: Icon(Icons.photo), - data: DragAndDropItem(child: Text('New default item')), + feedback: const Icon(Icons.photo), + data: DragAndDropItem(child: const Text('New default item')), + child: const Icon(Icons.photo), ), ), ), @@ -99,22 +97,22 @@ class _DragIntoListExample extends State { } _onItemAdd(DragAndDropItem newItem, int listIndex, int itemIndex) { - print('adding new item'); setState(() { - if (itemIndex == -1) + if (itemIndex == -1) { _contents[listIndex].children.add(newItem); - else + } else { _contents[listIndex].children.insert(itemIndex, newItem); + } }); } _onListAdd(DragAndDropListInterface newList, int listIndex) { - print('adding new list'); setState(() { - if (listIndex == -1) + if (listIndex == -1) { _contents.add(newList as DragAndDropList); - else + } else { _contents.insert(listIndex, newList as DragAndDropList); + } }); } } diff --git a/example/lib/expansion_tile_example.dart b/example/lib/expansion_tile_example.dart index df96a01..4590904 100644 --- a/example/lib/expansion_tile_example.dart +++ b/example/lib/expansion_tile_example.dart @@ -1,15 +1,12 @@ -import 'package:drag_and_drop_lists/drag_and_drop_list_expansion.dart'; import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; import 'package:example/navigation_drawer.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/widgets.dart'; class ExpansionTileExample extends StatefulWidget { - ExpansionTileExample({Key? key}) : super(key: key); + const ExpansionTileExample({Key? key}) : super(key: key); @override - _ListTileExample createState() => _ListTileExample(); + State createState() => _ListTileExample(); } class InnerList { @@ -37,9 +34,9 @@ class _ListTileExample extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Expansion Tiles'), + title: const Text('Expansion Tiles'), ), - drawer: NavigationDrawer(), + drawer: const NavigationDrawer(), body: DragAndDropLists( children: List.generate(_lists.length, (index) => _buildList(index)), onItemReorder: _onItemReorder, @@ -49,12 +46,12 @@ class _ListTileExample extends State { padding: const EdgeInsets.symmetric(vertical: 30.0), child: Center( child: Container( - padding: EdgeInsets.symmetric(vertical: 30.0, horizontal: 100.0), + padding: const EdgeInsets.symmetric(vertical: 30.0, horizontal: 100.0), decoration: BoxDecoration( border: Border.all(), borderRadius: BorderRadius.circular(7.0), ), - child: Icon(Icons.add_box), + child: const Icon(Icons.add_box), ), ), ), @@ -67,7 +64,7 @@ class _ListTileExample extends State { return DragAndDropListExpansion( title: Text('List ${innerList.name}'), subtitle: Text('Subtitle ${innerList.name}'), - leading: Icon(Icons.ac_unit), + leading: const Icon(Icons.ac_unit), children: List.generate(innerList.children.length, (index) => _buildItem(innerList.children[index])), listKey: ObjectKey(innerList), diff --git a/example/lib/fixed_example.dart b/example/lib/fixed_example.dart index 98b1bba..f9b6a91 100644 --- a/example/lib/fixed_example.dart +++ b/example/lib/fixed_example.dart @@ -1,14 +1,12 @@ -import 'package:drag_and_drop_lists/drag_and_drop_item.dart'; import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; import 'package:example/navigation_drawer.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; class FixedExample extends StatefulWidget { - FixedExample({Key? key}) : super(key: key); + const FixedExample({Key? key}) : super(key: key); @override - _FixedExample createState() => _FixedExample(); + State createState() => _FixedExample(); } class _FixedExample extends State { @@ -22,7 +20,7 @@ class _FixedExample extends State { return DragAndDropList( header: Row( children: [ - Expanded( + const Expanded( flex: 1, child: Divider(), ), @@ -32,7 +30,7 @@ class _FixedExample extends State { ? 'Header $index : Non-Draggable' : 'Header $index'), ), - Expanded( + const Expanded( flex: 1, child: Divider(), ), @@ -59,9 +57,9 @@ class _FixedExample extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Fixed Items'), + title: const Text('Fixed Items'), ), - drawer: NavigationDrawer(), + drawer: const NavigationDrawer(), body: DragAndDropLists( children: _contents, onItemReorder: _onItemReorder, diff --git a/example/lib/horizontal_example.dart b/example/lib/horizontal_example.dart index 88da73e..362802b 100644 --- a/example/lib/horizontal_example.dart +++ b/example/lib/horizontal_example.dart @@ -1,14 +1,12 @@ -import 'package:drag_and_drop_lists/drag_and_drop_item.dart'; import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; import 'package:example/navigation_drawer.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; class HorizontalExample extends StatefulWidget { - HorizontalExample({Key? key}) : super(key: key); + const HorizontalExample({Key? key}) : super(key: key); @override - _HorizontalExample createState() => _HorizontalExample(); + State createState() => _HorizontalExample(); } class InnerList { @@ -36,9 +34,9 @@ class _HorizontalExample extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Horizontal'), + title: const Text('Horizontal'), ), - drawer: NavigationDrawer(), + drawer: const NavigationDrawer(), body: DragAndDropLists( children: List.generate(_lists.length, (index) => _buildList(index)), onItemReorder: _onItemReorder, @@ -48,8 +46,8 @@ class _HorizontalExample extends State { listDraggingWidth: 150, listDecoration: BoxDecoration( color: Colors.grey[200], - borderRadius: BorderRadius.all(Radius.circular(7.0)), - boxShadow: [ + borderRadius: const BorderRadius.all(Radius.circular(7.0)), + boxShadow: const [ BoxShadow( color: Colors.black45, spreadRadius: 3.0, @@ -58,7 +56,7 @@ class _HorizontalExample extends State { ), ], ), - listPadding: EdgeInsets.all(8.0), + listPadding: const EdgeInsets.all(8.0), ), ); } @@ -70,11 +68,11 @@ class _HorizontalExample extends State { children: [ Expanded( child: Container( - decoration: BoxDecoration( + decoration: const BoxDecoration( borderRadius: BorderRadius.vertical(top: Radius.circular(7.0)), color: Colors.pink, ), - padding: EdgeInsets.all(10), + padding: const EdgeInsets.all(10), child: Text( 'Header ${innerList.name}', style: Theme.of(context).primaryTextTheme.headline6, @@ -87,12 +85,12 @@ class _HorizontalExample extends State { children: [ Expanded( child: Container( - decoration: BoxDecoration( + decoration: const BoxDecoration( borderRadius: BorderRadius.vertical(bottom: Radius.circular(7.0)), color: Colors.pink, ), - padding: EdgeInsets.all(10), + padding: const EdgeInsets.all(10), child: Text( 'Footer ${innerList.name}', style: Theme.of(context).primaryTextTheme.headline6, @@ -101,12 +99,12 @@ class _HorizontalExample extends State { ), ], ), - leftSide: VerticalDivider( + leftSide: const VerticalDivider( color: Colors.pink, width: 1.5, thickness: 1.5, ), - rightSide: VerticalDivider( + rightSide: const VerticalDivider( color: Colors.pink, width: 1.5, thickness: 1.5, diff --git a/example/lib/list_tile_example.dart b/example/lib/list_tile_example.dart index 0f1732f..1a793e9 100644 --- a/example/lib/list_tile_example.dart +++ b/example/lib/list_tile_example.dart @@ -1,14 +1,12 @@ import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; import 'package:example/navigation_drawer.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/widgets.dart'; class ListTileExample extends StatefulWidget { - ListTileExample({Key? key}) : super(key: key); + const ListTileExample({Key? key}) : super(key: key); @override - _ListTileExample createState() => _ListTileExample(); + State createState() => _ListTileExample(); } class _ListTileExample extends State { @@ -28,12 +26,12 @@ class _ListTileExample extends State { ), subtitle: Text('Header $index subtitle'), ), - Divider(), + const Divider(), ], ), footer: Column( children: [ - Divider(), + const Divider(), ListTile( title: Text( 'Footer $index', @@ -48,7 +46,7 @@ class _ListTileExample extends State { title: Text( 'Sub $index.1', ), - trailing: Icon(Icons.access_alarm), + trailing: const Icon(Icons.access_alarm), ), ), DragAndDropItem( @@ -56,7 +54,7 @@ class _ListTileExample extends State { title: Text( 'Sub $index.2', ), - trailing: Icon(Icons.alarm_off), + trailing: const Icon(Icons.alarm_off), ), ), DragAndDropItem( @@ -64,7 +62,7 @@ class _ListTileExample extends State { title: Text( 'Sub $index.3', ), - trailing: Icon(Icons.alarm_on), + trailing: const Icon(Icons.alarm_on), ), ), ], @@ -76,9 +74,9 @@ class _ListTileExample extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('List Tiles'), + title: const Text('List Tiles'), ), - drawer: NavigationDrawer(), + drawer: const NavigationDrawer(), body: DragAndDropLists( children: _contents, onItemReorder: _onItemReorder, @@ -87,19 +85,19 @@ class _ListTileExample extends State { padding: const EdgeInsets.symmetric(vertical: 30.0), child: Center( child: Container( - padding: EdgeInsets.symmetric(vertical: 40.0, horizontal: 100.0), + padding: const EdgeInsets.symmetric(vertical: 40.0, horizontal: 100.0), decoration: BoxDecoration( border: Border.all(), borderRadius: BorderRadius.circular(7.0), ), - child: Icon(Icons.add_box), + child: const Icon(Icons.add_box), ), ), ), - listPadding: EdgeInsets.symmetric(horizontal: 5, vertical: 10), + listPadding: const EdgeInsets.symmetric(horizontal: 5, vertical: 10), contentsWhenEmpty: Row( children: [ - Expanded( + const Expanded( child: Padding( padding: EdgeInsets.only(left: 40, right: 10), child: Divider(), @@ -111,7 +109,7 @@ class _ListTileExample extends State { color: Theme.of(context).textTheme.caption!.color, fontStyle: FontStyle.italic), ), - Expanded( + const Expanded( child: Padding( padding: EdgeInsets.only(left: 20, right: 40), child: Divider(), @@ -121,13 +119,13 @@ class _ListTileExample extends State { ), listDecoration: BoxDecoration( color: Theme.of(context).canvasColor, - borderRadius: BorderRadius.all(Radius.circular(6.0)), + borderRadius: const BorderRadius.all(Radius.circular(6.0)), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.5), spreadRadius: 2, blurRadius: 3, - offset: Offset(0, 3), // changes position of shadow + offset: const Offset(0, 3), // changes position of shadow ), ], ), diff --git a/example/lib/main.dart b/example/lib/main.dart index 0d04664..b942893 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -9,10 +9,12 @@ import 'package:example/sliver_example.dart'; import 'package:flutter/material.dart'; void main() { - runApp(MyApp()); + runApp(const MyApp()); } class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + // This widget is the root of your application. @override Widget build(BuildContext context) { @@ -24,14 +26,14 @@ class MyApp extends StatelessWidget { ), initialRoute: '/', routes: { - '/': (context) => BasicExample(), - '/list_tile_example': (context) => ListTileExample(), - '/expansion_tile_example': (context) => ExpansionTileExample(), - '/sliver_example': (context) => SliverExample(), - '/horizontal_example': (context) => HorizontalExample(), - '/drag_into_list_example': (context) => DragIntoListExample(), - '/fixed_example': (context) => FixedExample(), - '/drag_handle_example': (context) => DragHandleExample(), + '/': (context) => const BasicExample(), + '/list_tile_example': (context) => const ListTileExample(), + '/expansion_tile_example': (context) => const ExpansionTileExample(), + '/sliver_example': (context) => const SliverExample(), + '/horizontal_example': (context) => const HorizontalExample(), + '/drag_into_list_example': (context) => const DragIntoListExample(), + '/fixed_example': (context) => const FixedExample(), + '/drag_handle_example': (context) => const DragHandleExample(), }, ); } diff --git a/example/lib/navigation_drawer.dart b/example/lib/navigation_drawer.dart index 240d074..135a7f3 100644 --- a/example/lib/navigation_drawer.dart +++ b/example/lib/navigation_drawer.dart @@ -1,31 +1,32 @@ import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; class NavigationDrawer extends StatelessWidget { + const NavigationDrawer({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { return Drawer( child: ListView( children: [ ListTile( - title: Text('Basic'), - leading: Icon(Icons.list), + title: const Text('Basic'), + leading: const Icon(Icons.list), onTap: () { Navigator.of(context).pop(); Navigator.of(context).pushReplacementNamed('/'); }, ), ListTile( - title: Text('List Tiles'), - leading: Icon(Icons.view_list), + title: const Text('List Tiles'), + leading: const Icon(Icons.view_list), onTap: () { Navigator.of(context).pop(); Navigator.of(context).pushReplacementNamed('/list_tile_example'); }, ), ListTile( - title: Text('Expansion Tiles'), - leading: Icon(Icons.keyboard_arrow_down), + title: const Text('Expansion Tiles'), + leading: const Icon(Icons.keyboard_arrow_down), onTap: () { Navigator.of(context).pop(); Navigator.of(context) @@ -33,16 +34,16 @@ class NavigationDrawer extends StatelessWidget { }, ), ListTile( - title: Text('Slivers'), - leading: Icon(Icons.assignment), + title: const Text('Slivers'), + leading: const Icon(Icons.assignment), onTap: () { Navigator.of(context).pop(); Navigator.of(context).pushReplacementNamed('/sliver_example'); }, ), ListTile( - title: Text('Drag Into List'), - leading: Icon(Icons.add), + title: const Text('Drag Into List'), + leading: const Icon(Icons.add), onTap: () { Navigator.of(context).pop(); Navigator.of(context) @@ -50,24 +51,24 @@ class NavigationDrawer extends StatelessWidget { }, ), ListTile( - title: Text('Horizontal'), - leading: Icon(Icons.swap_horiz), + title: const Text('Horizontal'), + leading: const Icon(Icons.swap_horiz), onTap: () { Navigator.of(context).pop(); Navigator.of(context).pushReplacementNamed('/horizontal_example'); }, ), ListTile( - title: Text('Fixed Items'), - leading: Icon(Icons.block), + title: const Text('Fixed Items'), + leading: const Icon(Icons.block), onTap: () { Navigator.of(context).pop(); Navigator.of(context).pushReplacementNamed('/fixed_example'); }, ), ListTile( - title: Text('Drag Handle'), - leading: Icon(Icons.drag_handle), + title: const Text('Drag Handle'), + leading: const Icon(Icons.drag_handle), onTap: () { Navigator.of(context).pop(); Navigator.of(context) diff --git a/example/lib/sliver_example.dart b/example/lib/sliver_example.dart index c4bebed..47e9d2a 100644 --- a/example/lib/sliver_example.dart +++ b/example/lib/sliver_example.dart @@ -1,19 +1,17 @@ -import 'package:drag_and_drop_lists/drag_and_drop_item.dart'; import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; import 'package:example/navigation_drawer.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; class SliverExample extends StatefulWidget { - SliverExample({Key? key}) : super(key: key); + const SliverExample({Key? key}) : super(key: key); @override - _SliverExample createState() => _SliverExample(); + State createState() => _SliverExample(); } class _SliverExample extends State { late List _contents; - ScrollController _scrollController = ScrollController(); + final ScrollController _scrollController = ScrollController(); @override void initState() { @@ -23,7 +21,7 @@ class _SliverExample extends State { return DragAndDropList( header: Row( children: [ - Expanded( + const Expanded( flex: 1, child: Divider(), ), @@ -31,7 +29,7 @@ class _SliverExample extends State { padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), child: Text('Header $index'), ), - Expanded( + const Expanded( flex: 1, child: Divider(), ), @@ -63,7 +61,7 @@ class _SliverExample extends State { @override Widget build(BuildContext context) { return Scaffold( - drawer: NavigationDrawer(), + drawer: const NavigationDrawer(), body: CustomScrollView( controller: _scrollController, slivers: [ @@ -81,7 +79,7 @@ class _SliverExample extends State { ), ), SliverPadding( - padding: EdgeInsets.only(top: 20), + padding: const EdgeInsets.only(top: 20), sliver: DragAndDropLists( children: _contents, onItemReorder: _onItemReorder, diff --git a/lib/drag_and_drop_builder_parameters.dart b/lib/drag_and_drop_builder_parameters.dart index 75d909b..5fcc749 100644 --- a/lib/drag_and_drop_builder_parameters.dart +++ b/lib/drag_and_drop_builder_parameters.dart @@ -1,8 +1,5 @@ -import 'package:drag_and_drop_lists/drag_and_drop_item.dart'; -import 'package:drag_and_drop_lists/drag_and_drop_item_target.dart'; import 'package:drag_and_drop_lists/drag_and_drop_list_interface.dart'; import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; -import 'package:drag_and_drop_lists/drag_handle.dart'; import 'package:flutter/widgets.dart'; typedef void OnPointerMove(PointerMoveEvent event); diff --git a/lib/drag_and_drop_item.dart b/lib/drag_and_drop_item.dart index b70417b..2f0dccf 100644 --- a/lib/drag_and_drop_item.dart +++ b/lib/drag_and_drop_item.dart @@ -5,7 +5,7 @@ class DragAndDropItem implements DragAndDropInterface { /// The child widget of this item. final Widget child; - /// Widget when draggble + /// Widget when draggable final Widget? feedbackWidget; /// Whether or not this item can be dragged. diff --git a/lib/drag_and_drop_item_target.dart b/lib/drag_and_drop_item_target.dart index 0eb583a..bdcbe02 100644 --- a/lib/drag_and_drop_item_target.dart +++ b/lib/drag_and_drop_item_target.dart @@ -1,4 +1,3 @@ -import 'package:drag_and_drop_lists/drag_and_drop_builder_parameters.dart'; import 'package:drag_and_drop_lists/drag_and_drop_list_interface.dart'; import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; import 'package:flutter/material.dart'; diff --git a/lib/drag_and_drop_item_wrapper.dart b/lib/drag_and_drop_item_wrapper.dart index 251f320..022ce21 100644 --- a/lib/drag_and_drop_item_wrapper.dart +++ b/lib/drag_and_drop_item_wrapper.dart @@ -1,10 +1,6 @@ -import 'package:drag_and_drop_lists/drag_and_drop_builder_parameters.dart'; -import 'package:drag_and_drop_lists/drag_and_drop_item.dart'; import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; import 'package:drag_and_drop_lists/measure_size.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/widgets.dart'; class DragAndDropItemWrapper extends StatefulWidget { final DragAndDropItem child; diff --git a/lib/drag_and_drop_list_expansion.dart b/lib/drag_and_drop_list_expansion.dart index 668c264..085c51d 100644 --- a/lib/drag_and_drop_list_expansion.dart +++ b/lib/drag_and_drop_list_expansion.dart @@ -7,7 +7,6 @@ import 'package:drag_and_drop_lists/drag_and_drop_item_wrapper.dart'; import 'package:drag_and_drop_lists/drag_and_drop_list_interface.dart'; import 'package:drag_and_drop_lists/programmatic_expansion_tile.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; typedef void OnExpansionChanged(bool expanded); diff --git a/lib/drag_and_drop_list_wrapper.dart b/lib/drag_and_drop_list_wrapper.dart index 2530783..f19ab41 100644 --- a/lib/drag_and_drop_list_wrapper.dart +++ b/lib/drag_and_drop_list_wrapper.dart @@ -3,8 +3,6 @@ import 'package:drag_and_drop_lists/drag_and_drop_list_interface.dart'; import 'package:drag_and_drop_lists/drag_handle.dart'; import 'package:drag_and_drop_lists/measure_size.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/widgets.dart'; class DragAndDropListWrapper extends StatefulWidget { final DragAndDropListInterface dragAndDropList; diff --git a/lib/programmatic_expansion_tile.dart b/lib/programmatic_expansion_tile.dart index da24eca..a38bb23 100644 --- a/lib/programmatic_expansion_tile.dart +++ b/lib/programmatic_expansion_tile.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; -import 'package:flutter/widgets.dart'; const Duration _kExpand = Duration(milliseconds: 200);