penta_core 2.1.0 copy "penta_core: ^2.1.0" to clipboard
penta_core: ^2.1.0 copied to clipboard

A package for Penta Core, a Flutter package that provides a set of utilities and tools to help developers build high-quality applications quickly and efficiently.

example/lib/main.dart

import 'package:example/localization_example_page.dart';
import 'package:example/phone_field_example_page.dart';
import 'package:example/showcase_example_page.dart';
import 'package:example/toast_example_page.dart';
import 'package:flutter/material.dart';
import 'package:penta_core/penta_core.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await LocaleManager.I.initialize(
    assetFolderPath: 'assets/translations',
    enumValues: AppLocale.values,
  );

  runApp(
    LocaleManagerProvider.create(defaultLocale: AppLocale.en, child: _MyApp()),
  );
}

class _MyApp extends StatelessWidget {
  _MyApp();

  final _pages = [
    (ToastExamplePage(), 'Toast Example'),
    (PhoneFieldExamplePage(), 'Phone Field Example'),
    (LocalizationExamplePage(), 'Localization Example'),
    (ShowcaseExamplePage(), 'Showcase Example'),
  ];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      builder: (_, child) {
        return PentaToast(
          config: PentaToastConfig(
            backgroundColor: Colors.black.withValues(alpha: 0.5),
            borderRadius: BorderRadius.circular(10),
            padding: EdgeInsets.all(10),
            animationDuration: Duration(milliseconds: 300),
            boxShadow: [
              BoxShadow(
                color: Colors.black.withValues(alpha: 0.5),
                blurRadius: 8,
                offset: Offset(0, 2),
              ),
            ],
            position: PentaToastPosition.bottomCenter,
            duration: Duration(seconds: 3),
            maxToasts: 2,
          ),
          child: child!,
        );
      },
      home: Builder(
        builder: (context) {
          return Scaffold(
            body: Center(
              child: SingleChildScrollView(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children:
                      _pages
                          .map(
                            (page) => ElevatedButton(
                              onPressed: () {
                                Navigator.push(
                                  context,
                                  MaterialPageRoute(builder: (_) => page.$1),
                                );
                              },
                              child: Text(page.$2),
                            ),
                          )
                          .toList(),
                ),
              ),
            ),
          );
        },
      ),
    );
  }
}
0
likes
130
points
6
downloads

Publisher

unverified uploader

Weekly Downloads

A package for Penta Core, a Flutter package that provides a set of utilities and tools to help developers build high-quality applications quickly and efficiently.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

ansicolor, build, flutter, internet_connection_checker, intl, path, source_gen

More

Packages that depend on penta_core