Skip to content

Vishwa-Karthik/Flutter-Slidable-Widget

Repository files navigation

Flutter - Slidable

A simple way to use Slidable widget inside flutter.

Add Dependency

flutter pub add flutter_slidable

Results

Code

return Scaffold(
      backgroundColor: Colors.deepPurple[200],
      appBar: AppBar(
        title: const Text("S L I D A B L E"),
        centerTitle: true,
      ),
      body: Center(
          child: Slidable(
        startActionPane: ActionPane(
          motion: const ScrollMotion(),
          children: [
            SlidableAction(
              flex: 2,
              onPressed: ((context) {
                // call phone
              }),
              icon: Icons.phone,
              backgroundColor: Colors.green,
            ),
            SlidableAction(
              onPressed: ((context) {
                // text phone
              }),
              icon: Icons.chat,
              backgroundColor: Colors.blue,
            ),
          ],
        ),
        endActionPane: ActionPane(
          motion: const ScrollMotion(),
          children: [
            SlidableAction(
              onPressed: ((context) {
                // delete phone
              }),
              icon: Icons.delete_forever,
              backgroundColor: Colors.red,
            ),
          ],
        ),
        child: Container(
          color: Colors.deepPurple[300],
          child: const ListTile(
            title: Text(
              "Vishwa Karthik",
              style:
                  TextStyle(fontWeight: FontWeight.bold, color: Colors.white70),
            ),
            subtitle: Text(
              "GITHUB",
              style: TextStyle(
                fontWeight: FontWeight.bold,
              ),
            ),
            leading: Icon(
              Icons.person,
              size: 60,
            ),
          ),
        ),
      )),
    );

Reference

pub.dev: FLUTTER_SLIDABLE

About

Simple example to handle Slidable Widget - like - EMAILS

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages