focus_detector 1.0.3 copy "focus_detector: ^1.0.3" to clipboard
focus_detector: ^1.0.3 copied to clipboard

outdated

Android's onResume/onPause and iOS's viewDidAppear/viewDidDisappear for Flutter.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:focus_detector/focus_detector.dart';

void main() {
  runApp(
    MyApp(),
  );
}

class MyApp extends StatelessWidget {
  final _resumeDetectorKey = UniqueKey();

  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'FocusDetector Example',
        theme: ThemeData(
          primarySwatch: Colors.green,
        ),
        home: FocusDetector(
          key: _resumeDetectorKey,
          child: Scaffold(
            appBar: AppBar(
              title: Text('FocusDetector Example'),
            ),
          ),
          onFocusGained: () {
            print('Focus gained, equivalent to onResume or viewDidAppear');
          },
          onFocusLost: () {
            print('Focus lost, equivalent to onPause or viewDidDisappear');
          },
        ),
      );
}
338
likes
0
pub points
98%
popularity

Publisher

verified publisheredsonbueno.com

Android's onResume/onPause and iOS's viewDidAppear/viewDidDisappear for Flutter.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, visibility_detector

More

Packages that depend on focus_detector