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

A flutter package that animates the TextField hint

example/lib/main.dart

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

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  AnimationType _animationType = AnimationType.slide;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: Scaffold(
        body: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Center(
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                AnimatedHintTextField(
                  fixedHint: "Search",
                  hints: const ['\"Flights\"', '\"Accounts\"'],
                  animationType: _animationType,
                  onTapOutside: (_) {
                    FocusScope.of(context).unfocus();
                  },
                ),
                const SizedBox(height: 20),
                DropdownMenu<AnimationType>(
                  initialSelection: _animationType,
                  dropdownMenuEntries: AnimationType.values
                      .map(
                        (item) => DropdownMenuEntry(
                          label: item.name,
                          value: item,
                        ),
                      )
                      .toList(),
                  onSelected: (value) {
                    if (value != null) {
                      setState(() {
                        _animationType = value;
                      });
                    }
                  },
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
6
likes
130
points
16
downloads

Publisher

verified publisheriamdipanshus.in

Weekly Downloads

A flutter package that animates the TextField hint

Repository (GitHub)
View/report issues

Topics

#flutter #field #ui #textfield

Documentation

API reference

License

MIT (license)

Dependencies

animated_text_kit, flutter

More

Packages that depend on animated_hint