gabrimatic_utils 0.0.7 copy "gabrimatic_utils: ^0.0.7" to clipboard
gabrimatic_utils: ^0.0.7 copied to clipboard

discontinued

A set of useful tools to make development more easily. A bunch of date utils, restart and exit app functions, string extensions and etc.

example/lib/main.dart

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

void main() {
  runApp(Creator(child: ExampleApp()));
}

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

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        children: [
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: TextButton(
              onPressed: () {
                Creator.recreate(context);
              },
              child: Text(
                'Restart App!',
                style: Theme.of(context).textTheme.headline4,
              ),
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: TextButton(
              onPressed: () {
                DateUtils(isJalali: false).showDatePickerDateTime(context);
              },
              child: Text(
                'Show datepicker',
                style: Theme.of(context).textTheme.headline4,
              ),
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: TextButton(
              onPressed: () {
                DateUtils(isJalali: false).showTheTimePicker(context);
              },
              child: Text(
                'Show timepicker',
                style: Theme.of(context).textTheme.headline4,
              ),
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: TextButton(
              onPressed: () {
                print(''.gIsEmpty); // returns: true
                print('null'.gIsEmpty); // returns: true
                print('    '.gIsEmpty); // returns: true
              },
              child: Text(
                'Check string',
                style: Theme.of(context).textTheme.headline4,
              ),
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: TextButton(
              onPressed: () {
                print('5'.addExtraZero); // returns: 05
              },
              child: Text(
                'Add zero',
                style: Theme.of(context).textTheme.headline4,
              ),
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: TextButton(
              onPressed: () {
                print(enDigitToFaDigit('123456789')); // returns: ٠۱۲۳۴۵۶۷۸۹
              },
              child: Text(
                'Convert english digits to farsi digits',
                style: Theme.of(context).textTheme.headline4,
              ),
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: TextButton(
              onPressed: () {
                shortIf(
                  p1: 'First value', // First parameter in condition
                  // p2: 'Second value', if p2 was null, p1 returns
                  returnValue: 'First is Second',
                );
              },
              child: Text(
                'Short if',
                style: Theme.of(context).textTheme.headline4,
              ),
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: TextButton(
              onPressed: () {
                exitApp();
              },
              child: Text(
                'Exit!',
                style: Theme.of(context).textTheme.headline4,
              ),
            ),
          ),
        ],
      ),
    );
  }
}
1
likes
30
pub points
0%
popularity

Publisher

verified publishergabrimatic.info

A set of useful tools to make development more easily. A bunch of date utils, restart and exit app functions, string extensions and etc.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

easy_localization, flutter, jalali_calendar, persian_date, persian_datetime_picker

More

Packages that depend on gabrimatic_utils