Skip to content

Instantly share code, notes, and snippets.

View agordeev's full-sized avatar

Andrey Gordeev agordeev

View GitHub Profile
@agordeev
agordeev / keyboard_top_hook.dart
Last active March 7, 2024 15:22
Keyboard Avoiding Flutter Hook
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
/// Returns the top of the keyboard.
/// Thus, if the keyboard is hidden, it returns the height of the screen.
/// Can be used to avoid the keyboard on a screen with text fields.
double useKeyboardTop() {
return use(const _KeyboardTopHook());
}

Keybase proof

I hereby claim:

  • I am agordeev on github.
  • I am agordeev (https://keybase.io/agordeev) on keybase.
  • I have a public key ASDDbxMlmDy5YNOT5H2J4wJQzHV7-zaOmr7pZ5b45Yx0DAo

To claim this, I am signing this object:

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
title: 'CachedNetworkImage Hero',
theme: ThemeData(primarySwatch: Colors.blue),