Last active
March 30, 2019 20:44
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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