diff --git a/CHANGELOG.md b/CHANGELOG.md index ac07159..60d67bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -## [0.0.1] - TODO: Add release date. +## [1.0.0] - April 2020 -* TODO: Describe initial release. +* Initial Open Source release. diff --git a/LICENSE b/LICENSE index ba75c69..518d577 100644 --- a/LICENSE +++ b/LICENSE @@ -1 +1,21 @@ -TODO: Add your license here. +MIT License + +Copyright (c) 2020 drogel + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/example/lib/main.dart b/example/lib/main.dart index 25990e3..cbf6cd7 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -6,34 +6,54 @@ void main() => runApp(Example()); class Example extends StatelessWidget { @override Widget build(BuildContext context) => MaterialApp( - home: Scaffold( - resizeToAvoidBottomInset: false, - appBar: AppBar(title: const Text("Keyboard Attachable demo")), - body: FooterLayout( - footer: KeyboardAttachable( - backgroundColor: Colors.blueAccent[700], - child: Container( - padding: const EdgeInsets.all(16), - color: Colors.blueAccent[700], - child: TextField( - decoration: InputDecoration( - hintText: "Tap me!", - fillColor: Colors.white, - filled: true, - border: const OutlineInputBorder(), - ), - ), - ), - ), - child: ListView.builder( - shrinkWrap: true, - itemCount: Colors.primaries.length, - itemBuilder: (_, i) => Container( - height: 88, - color: Colors.primaries[i].withOpacity(0.2), - ), + title: 'Keyboard Attachable Demo', + debugShowCheckedModeBanner: false, + theme: ThemeData(primarySwatch: Colors.blue), + home: KeyboardAttachablePage(), + ); +} + +/// Builds a [Scaffold] that lays out a footer at the bottom of the page. +class KeyboardAttachablePage extends StatelessWidget { + @override + Widget build(BuildContext context) => Scaffold( + resizeToAvoidBottomInset: false, + appBar: AppBar(title: const Text("Keyboard Attachable demo")), + body: FooterLayout( + footer: KeyboardAttachableFooter(), + child: ColorsList(), + ), + ); +} + +/// Builds a footer that animates its bottom space when the keyboard is shown. +class KeyboardAttachableFooter extends StatelessWidget { + @override + Widget build(BuildContext context) => KeyboardAttachable( + backgroundColor: Colors.blueAccent[700], + child: Container( + padding: const EdgeInsets.all(16), + color: Colors.blueAccent[700], + child: TextField( + decoration: InputDecoration( + hintText: "Tap me!", + fillColor: Colors.white, + filled: true, + border: const OutlineInputBorder(), ), ), ), ); } + +/// Builds a [ListView] made of colored containers that fill the page. +class ColorsList extends StatelessWidget { + @override + Widget build(BuildContext context) => ListView.builder( + itemCount: Colors.primaries.length, + itemBuilder: (_, i) => Container( + height: 88, + color: Colors.primaries[i].withOpacity(0.2), + ), + ); +} diff --git a/pubspec.yaml b/pubspec.yaml index dc3a10e..59a4f6e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,8 +1,7 @@ name: keyboard_attachable description: A Flutter package to build widgets that can be attached to the soft keyboard. -version: 0.0.1 -author: -homepage: +version: 1.0.0 +homepage: https://github.com/drogel/keyboard_attachable environment: sdk: ">=2.7.0 <3.0.0" @@ -15,4 +14,5 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter + flutter: \ No newline at end of file