flutter_context_dtx 1.4.1 copy "flutter_context_dtx: ^1.4.1" to clipboard
flutter_context_dtx: ^1.4.1 copied to clipboard

A package that simplifies the access most of used properties/functions right in the BuildContext.

example/lib/main.dart

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

import 'pages/focus_scope.dart';
import 'pages/form.dart';

void main() => runApp(const MyApp());

class Routes {
  static const focusScope = '/focusScopePage';
  static const form = '/formPage';
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        scaffoldBackgroundColor: Colors.white24,
        primaryTextTheme: const TextTheme(
          titleLarge: TextStyle(color: Colors.blue),
        ),
      ),
      home: const HomePage(),
      routes: {
        Routes.focusScope: (_) => const FocusScopePage(),
        Routes.form: (_) => const FormPage(),
      },
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: context.scaffoldBackgroundColor,
      appBar: AppBar(),
      body: Center(
        child: SingleChildScrollView(
          child: Column(
            children: <Widget>[
              ElevatedButton(
                onPressed: () => context.pushNamed(Routes.form),
                child: Text(
                  'Form Example',
                  style: context.headline6TextStyle,
                ),
              ),
              const SizedBox(height: 16),
              ElevatedButton(
                onPressed: () => context.pushNamed(Routes.focusScope),
                child: Text(
                  'Focus Scope Example',
                  style: context.headline6TextStyle,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
6
likes
120
pub points
36%
popularity

Publisher

verified publisherkmartins.dev

A package that simplifies the access most of used properties/functions right in the BuildContext.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_context_dtx