system_date_time_format_hook 1.2.1 copy "system_date_time_format_hook: ^1.2.1" to clipboard
system_date_time_format_hook: ^1.2.1 copied to clipboard

A flutter hook for system_date_time_format plugin for getting date and time format patterns from device system settings.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:system_date_time_format_hook/system_date_time_format_hook.dart';
import 'package:system_date_time_format_hook_example/fallbacks.dart';
import 'package:system_date_time_format_hook_example/widgets/widgets.dart';

void main() {
  runApp(const App());
}

class App extends HookWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    final patterns = useSystemDateTimeFormat();

    final datePattern = patterns.datePattern ?? Fallbacks.datePattern;
    final mediumDatePattern =
        patterns.mediumDatePattern ?? Fallbacks.mediumDatePattern;
    final longDatePattern =
        patterns.longDatePattern ?? Fallbacks.longDatePattern;
    final fullDatePattern =
        patterns.fullDatePattern ?? Fallbacks.fullDatePattern;
    final timePattern = patterns.timePattern ?? Fallbacks.timePattern;

    final rows = {
      'Short date format pattern:': datePattern,
      'Medium date format pattern:': mediumDatePattern,
      'Long date format pattern:': longDatePattern,
      'Full date format pattern:': fullDatePattern,
      'Time format pattern:': timePattern,
    };

    return MaterialApp(
      home: Scaffold(
        appBar: const Toolbar(),
        body: Body(
          children: rows.entries
              .map((e) => RowItem(title: e.key, value: e.value))
              .toList(),
        ),
      ),
    );
  }
}
3
likes
160
points
41
downloads

Publisher

verified publisherdominikkrajcer.com

Weekly Downloads

A flutter hook for system_date_time_format plugin for getting date and time format patterns from device system settings.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_hooks, system_date_time_format

More

Packages that depend on system_date_time_format_hook