tag_form_field 0.0.2 tag_form_field: ^0.0.2 copied to clipboard
TagFormField is a customizable Flutter widget that allows users to input and display tags in a form field.
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:tag_form_field/tag_field.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Tag Field'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Container(
margin: const EdgeInsets.all(16.0),
child: TagFormField(
decoration: const InputDecoration(
hintText: 'Enter TAG separate with comma (,)',
),
onValueChanged: (value) {
log('$value');
},
),
),
),
);
}
}