thai_province_dropdown 0.0.2 copy "thai_province_dropdown: ^0.0.2" to clipboard
thai_province_dropdown: ^0.0.2 copied to clipboard

A Flutter widget for easily selecting Thai provinces, districts (amphures), subdistricts (tambons), and zip codes.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'Province'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  final controller = ThaiProvincesController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,

        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            //
            Text('province = ${controller.provinceId}'),
            Text('district = ${controller.amphureId}'),
            Text('subdistrict = ${controller.tambonId}'),
            Text('zipcoce = ${controller.zipcode}'),
            SizedBox(height: 4.0),
            //
            ThaiProvincesDropdown(
              controller: controller,
              direction: Axis.vertical,
              width: 280.0,
              padding: EdgeInsets.all(4.0),
              locale: Locale('th', 'TH'),
            ),
            SizedBox(height: 4.0),
            //
            FilledButton(
              onPressed: () {
                //
                setState(() {});
              },
              child: Text('Submit'),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
160
points
18
downloads

Documentation

API reference

Publisher

verified publisherredlinesoft.net

Weekly Downloads

A Flutter widget for easily selecting Thai provinces, districts (amphures), subdistricts (tambons), and zip codes.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on thai_province_dropdown