Skip to content

Instantly share code, notes, and snippets.

@chrislentz
Last active March 30, 2019 20:44
Show Gist options
  • Save chrislentz/6cfc2c8053934b3db9a474b481d3c0c9 to your computer and use it in GitHub Desktop.
Save chrislentz/6cfc2c8053934b3db9a474b481d3c0c9 to your computer and use it in GitHub Desktop.
This is the full code sample used in my "Flutter Dismissible (Swipe Left)" example on Instagram.
import 'package:flutter/material.dart';
void main() => runApp(ExampleApp());
class ExampleApp extends StatelessWidget {
final items = List<String>.generate(20, (i) => "Swipe To The Left");
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
final item = items[index];
return Dismissible(
key: Key(item),
background: Container(
color: Color(0xff8fc3ff),
),
direction: DismissDirection.endToStart,
child: Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey,
),
),
),
child: ListTile(
title: Text('$item'),
),
),
);
},
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment