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

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

example/lib/main.dart

import 'package:example/pages/focus_scope.dart';
import 'package:example/pages/form.dart';
import 'package:flutter/material.dart';
import 'package:flutter_context_dtx/flutter_context_dtx.dart';

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.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({super.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
150
pub points
33%
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