flexible_dropdown 1.0.4 copy "flexible_dropdown: ^1.0.4" to clipboard
flexible_dropdown: ^1.0.4 copied to clipboard

Allows the dropdown to be dismissed by tapping | panning the scrim and Set transparent for header(Barrier)

example/lib/main.dart

import 'package:flexible_dropdown/flexible_dropdown.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> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Colors.white,
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: SizedBox.expand(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.start,
            children: [
              const SafeArea(child: SizedBox(height: 15)),
              _buildFlexibleDropdown(),
              const SafeArea(child: SizedBox(height: 15)),
            ],
          ),
        ),
      ),
    );
  }

  Widget _buildTextBtn(String title) {
    return Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(6),
        color: Colors.blueAccent.withOpacity(.2),
      ),
      child: Padding(
        padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
        child: Text(
          title,
          style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
        ),
      ),
    );
  }

  Widget _buildFlexibleDropdown() {
    return FlexibleDropdown(
      overlayChild: Container(
        height: 160,
        width: double.infinity,
        color: Colors.deepPurple,
      ),
      barrierColor: Colors.black38.withOpacity(.2),
      barrierShape: BarrierShape.headerTrans,
      textDirection: TextDirection.ltr,
      duration: const Duration(milliseconds: 400),
      animationType: AnimationType.scaleY,
      animationAlignment: Alignment.topCenter,
      offset: Offset.zero,
      child: _buildTextBtn('Flexible Dropdown'),
    );
  }
}
15
likes
0
pub points
80%
popularity

Publisher

unverified uploader

Allows the dropdown to be dismissed by tapping | panning the scrim and Set transparent for header(Barrier)

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flexible_dropdown