flutter_keyboard_size 1.0.1 flutter_keyboard_size: ^1.0.1 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: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({
Key? key,
required 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),
),
);
}
}