Merge pull request #5 from Iconica-Development/doc/improve-documentation

doc: create documentation for file
This commit is contained in:
Freek van de Ven 2024-03-06 07:57:16 +01:00 committed by GitHub
commit 5c950d7bef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 0 deletions

9
LICENSE Normal file
View file

@ -0,0 +1,9 @@
Copyright (c) 2024 Iconica, All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -8,7 +8,22 @@ import 'package:flutter_grid_to_list/src/animated_grid_to_list_type.dart';
export 'animated_grid_to_list_item_builder.dart';
/// A widget that animates between a grid and list view.
///
/// This widget takes an [itemBuilder] to build the items and a [controller]
/// to manage the state of the animation.
/// By default, it starts with a grid view,
/// but this behavior can be changed by setting [startWithGrid] to false.
///
/// The [onTap] function can be provided to handle tap events on items.
class AnimatedGridToList extends StatefulWidget {
/// Constructs an [AnimatedGridToList] widget.
///
/// The [itemBuilder] is required to build items for the grid and list views.
/// The [controller] is required to manage the state of the animation.
/// The [startWithGrid] parameter determines whether the widget
/// starts with a grid view.
/// The [onTap] function can be used to handle tap events on items.
const AnimatedGridToList({
required this.itemBuilder,
required this.controller,
@ -75,6 +90,11 @@ class _AnimatedGridToListState extends State<AnimatedGridToList>
}
}
/// A controller class for managing the state of
/// the [AnimatedGridToList] widget.
///
/// This controller provides methods to resize, shrink, or expand the widget,
/// as well as retrieving the current status of the widget.
class AnimatedGridToListController extends ChangeNotifier {
final ScrollController _scrollController = ScrollController();