smart_time_field_picker 0.0.1 copy "smart_time_field_picker: ^0.0.1" to clipboard
smart_time_field_picker: ^0.0.1 copied to clipboard

A smart, fully customizable Flutter time picker field with support for 12-hour and 24-hour formats. `time_picker_input` lets users select or type time directly into a TextFormField with intelligent fo [...]

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'FormFiled DropDown Example',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(
          seedColor: Colors.deepPurple,
          primary: Colors.deepPurple,
        ),
        appBarTheme: const AppBarTheme(color: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const DropDownClass(),
    );
  }
}

class DropDownClass extends StatefulWidget {
  const DropDownClass({super.key});

  @override
  State<DropDownClass> createState() => _DropDownClassState();
}

class _DropDownClassState extends State<DropDownClass> {
  final dropdownKey = GlobalKey<SmartTimeFieldState>();
  final countryController = OverlayPortalController();
  String? value = "12:10 AM";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text(
          "FormFiled DropDown Example",
          style: TextStyle(color: Colors.white),
        ),
      ),
      body: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Column(
          children: [
            Expanded(
              child: SmartTimeField(
                user12Hr: true,
                key: dropdownKey,
                controller: countryController,
                initialItem: value,
                autoValidateMode: AutovalidateMode.onUserInteraction,
                timePickerDecoration: TimePickerDecoration(
                  menuDecoration: BoxDecoration(
                    color: Colors.white,
                    border: Border.all(color: Colors.blue),
                  ),
                ),
                textStyle: const TextStyle(
                  fontSize: 12,
                  fontWeight: FontWeight.w400,
                ),
                onChanged: (String? va) {
                  value = va;
                },
                listItemBuilder: (context, item, isSelected) {
                  return Container(
                    padding: const EdgeInsets.symmetric(
                      horizontal: 5,
                      vertical: 5,
                    ),
                    margin: EdgeInsets.fromLTRB(5, 2, 5, 1),
                    decoration: BoxDecoration(
                      color: isSelected ? Colors.green : Colors.transparent,
                      borderRadius: BorderRadius.circular(2),
                    ),
                    child: Text(
                      item,
                      style: TextStyle(
                        fontSize: 12,
                        color: isSelected ? Colors.white : Colors.black,
                        fontWeight: FontWeight.w400,
                      ),
                    ),
                  );
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}
6
likes
0
points
9
downloads

Publisher

unverified uploader

Weekly Downloads

A smart, fully customizable Flutter time picker field with support for 12-hour and 24-hour formats. `time_picker_input` lets users select or type time directly into a TextFormField with intelligent formatting, search-enabled dropdown, and full keyboard navigation. Perfect for time selection in forms, shifts, schedules, and more.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cupertino_icons, flutter, mask_text_input_formatter

More

Packages that depend on smart_time_field_picker