Skip to content

Commit

Permalink
refactors example for clarity, prepares license and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
drogel committed Apr 19, 2020
1 parent d13c45a commit 930fd65
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 32 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## [0.0.1] - TODO: Add release date.
## [1.0.0] - April 2020

* TODO: Describe initial release.
* Initial Open Source release.
22 changes: 21 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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.
72 changes: 46 additions & 26 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
);
}
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -15,4 +14,5 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter

flutter:

0 comments on commit 930fd65

Please sign in to comment.