flutter_custom_utility 1.0.1 copy "flutter_custom_utility: ^1.0.1" to clipboard
flutter_custom_utility: ^1.0.1 copied to clipboard

This package includes Common Utility function, Validation, Regex, and Date and Time utilities.

example/lib/main.dart

import 'package:example/src/pages/common_utility_example_page.dart';
import 'package:example/src/pages/date_time_utility_example.dart';
import 'package:example/src/pages/validation_regex_example_page.dart';
import 'package:flutter/material.dart';
import 'package:intl/date_symbol_data_local.dart';

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

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

  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'Flutter Demo',
        debugShowCheckedModeBanner: false,
        theme: ThemeData(
          colorScheme: ColorScheme.fromSeed(
            seedColor: Colors.deepPurple,
          ),
          useMaterial3: true,
        ),
        home: const MyHomePage(
          title: 'Flutter Custom Utility',
        ),
      );
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({
    super.key,
    required this.title,
  });
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    initializeDateFormatting();
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            exampleList(
              "DateTime Utility Example",
              () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (BuildContext context) =>
                        const DateTimeUtilityExamplePage(),
                  ),
                );
              },
            ),
            exampleList(
              "Common Utility Example",
              () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (BuildContext context) =>
                        const CommonUtilityExamplePage(),
                  ),
                );
              },
            ),
            exampleList(
              "Regex Validation Example",
              () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (BuildContext context) =>
                        const ValidationRegexExamplePage(),
                  ),
                );
              },
            ),
          ],
        ),
      ),
    );
  }

  Widget exampleList(String title, Function onTap) => Column(
        children: [
          GestureDetector(
            onTap: () {
              onTap();
            },
            child: Padding(
              padding: const EdgeInsets.all(16.0),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Expanded(
                    child: Text(
                      title,
                      style: const TextStyle(
                        color: Colors.black,
                        fontSize: 18,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ),
                  const Icon(
                    Icons.arrow_forward_ios_sharp,
                    color: Colors.black,
                    size: 18,
                  )
                ],
              ),
            ),
          ),
          const Divider(
            color: Colors.black,
            thickness: 1,
            height: 1,
          )
        ],
      );
}
4
likes
140
points
116
downloads

Publisher

verified publisherjarvistechnolabs.com

Weekly Downloads

This package includes Common Utility function, Validation, Regex, and Date and Time utilities.

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_cache_manager, fluttertoast, intl, open_filex, url_launcher

More

Packages that depend on flutter_custom_utility