flutter_keyboard_size 1.0.0+2 flutter_keyboard_size: ^1.0.0+2 copied to clipboard
A straightforward and convenient provider that helps get info about - keyboard height, is it open or not, set bool value is screen small or not.
import 'package:flutter/material.dart';
import 'package:flutter_keyboard_size/flutter_keyboard_size.dart';
import 'body_of_main_screen.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return KeyboardSizeProvider(
smallSize: 500.0,
child: Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: BodyOfMainScreen(counter: _counter),
),
);
}
}