animated_pill 1.0.3 copy "animated_pill: ^1.0.3" to clipboard
animated_pill: ^1.0.3 copied to clipboard

A Flutter widget that creates an animated pill-shaped container with customizable appearance and animation properties.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:animated_pill/animated_pill.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Animated Pill Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

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

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

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Animated Pill Demo'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: SingleChildScrollView(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const Text(
              'Basic Usage',
              style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
            ),
            const SizedBox(height: 16),
            AnimatedPill(
              'New Feature',
              backgroundColor: Colors.green,
              textColor: Colors.white,
            ),
            const SizedBox(height: 32),
            const Text(
              'Customized Appearance',
              style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
            ),
            const SizedBox(height: 16),
            AnimatedPill(
              'Limited Time Offer!',
              backgroundColor: Colors.black,
              textColor: Colors.white,
              fontSize: 14.0,
              borderRadius: 20.0,
              padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
            ),
            const SizedBox(height: 32),
            const Text(
              'Customized Animation - 3 Loops',
              style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
            ),
            const SizedBox(height: 16),
            AnimatedPill(
              'Flash Sale',
              animationLoops: 3,
              animationDuration: const Duration(milliseconds: 200),
              pauseDuration: const Duration(milliseconds: 1000),
              backgroundColor: Colors.red,
              textColor: Colors.white,
            ),
            const SizedBox(height: 32),
            const Text(
              'No Animation',
              style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
            ),
            const SizedBox(height: 16),
            AnimatedPill(
              'Static Pill',
              animationLoops: 0,
              backgroundColor: Colors.blue,
              textColor: Colors.white,
            ),
          ],
        ),
      ),
    );
  }
}
copied to clipboard
1
likes
160
points
168
downloads

Publisher

verified publisheranantdubey.com

Weekly Downloads

2024.09.13 - 2025.03.28

A Flutter widget that creates an animated pill-shaped container with customizable appearance and animation properties.

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on animated_pill