system_date_time_format 0.7.1 copy "system_date_time_format: ^0.7.1" to clipboard
system_date_time_format: ^0.7.1 copied to clipboard

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

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:system_date_time_format/system_date_time_format.dart';
import 'package:system_date_time_format_example/fallbacks.dart';
import 'package:system_date_time_format_example/widgets/widgets.dart';

void main() {
  runApp(const SDTFScope(child: App()));
}

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

  @override
  Widget build(BuildContext context) {
    final patterns = SystemDateTimeFormat.of(context);

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

    final rows = {
      'System short date format pattern:': datePattern,
      'System medium date format pattern:': mediumDatePattern,
      'System long date format pattern:': longDatePattern,
      'System 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(),
        ),
      ),
    );
  }
}
14
likes
0
pub points
91%
popularity

Publisher

verified publisherdominikkrajcer.com

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

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, js, plugin_platform_interface

More

Packages that depend on system_date_time_format