kitforge 0.2.1 copy "kitforge: ^0.2.1" to clipboard
kitforge: ^0.2.1 copied to clipboard

An all-in-one Flutter toolkit — permissions, connectivity, toast, dialogs, bottom sheets, animation helpers, navigation, storage, logging, HTTP, validators, OTP fields, image/camera picking, lo[...]

example/lib/main.dart

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

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await KitStorage.init();
  runApp(const ExampleApp());
}

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorKey:
          KitNavigation.navigatorKey, // required for context-free modules
      title: 'KitForge Example',
      theme: ThemeData(colorSchemeSeed: Colors.indigo, useMaterial3: true),
      home: const HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('KitForge')),
      body: KitNetworkBanner(
        onlineText: 'Back online',
        child: ListView(
          padding: const EdgeInsets.all(16),
          children: [
            KitFadeIn(child: const Text('Toast, dialogs & sheets')),
            const SizedBox(height: 12),
            Wrap(
              spacing: 8,
              runSpacing: 8,
              children: [
                ElevatedButton(
                  onPressed: () => KitToast.success('Saved successfully'),
                  child: const Text('Show toast'),
                ),
                ElevatedButton(
                  onPressed: () async {
                    final ok = await KitDialogs.confirm(
                      title: 'Delete item?',
                      message: 'This cannot be undone.',
                      isDestructive: true,
                    );
                    if (ok == true) KitToast.error('Deleted');
                  },
                  child: const Text('Confirm dialog'),
                ),
                ElevatedButton(
                  onPressed: () => KitBottomSheet.actions<String>(
                    title: 'Choose an action',
                    [
                      const KitSheetAction(
                          label: 'Share', value: 'share', icon: Icons.share),
                      const KitSheetAction(
                        label: 'Delete',
                        value: 'delete',
                        icon: Icons.delete,
                        isDestructive: true,
                      ),
                    ],
                  ),
                  child: const Text('Action sheet'),
                ),
              ],
            ),
            const Divider(height: 32),
            const Text('OTP field'),
            const SizedBox(height: 8),
            KitOtpField(
                length: 4, onCompleted: (code) => KitToast.show('Code: $code')),
            const Divider(height: 32),
            ElevatedButton(
              onPressed: () async {
                final result =
                    await KitPermission.request(KitPermissionType.location);
                result.when(
                  success: (_) =>
                      KitToast.success('Location permission granted'),
                  failure: (message, _) => KitToast.error(message),
                );
              },
              child: const Text('Request location permission'),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
135
points
18
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

An all-in-one Flutter toolkit — permissions, connectivity, toast, dialogs, bottom sheets, animation helpers, navigation, storage, logging, HTTP, validators, OTP fields, image/camera picking, lo[...]

Repository (GitHub)
View/report issues
Contributing

Topics

#utilities #networking #storage #permissions #widget

License

MIT (license)

Dependencies

connectivity_plus, dio, flutter, flutter_local_notifications, flutter_secure_storage, geolocator, google_maps_flutter, image_picker, logger, permission_handler, shared_preferences, timezone, workmanager

More

Packages that depend on kitforge