Skip to content

Instantly share code, notes, and snippets.

@becek2n
Created May 8, 2020 14:46
Show Gist options
  • Save becek2n/14bf42d8b76617b5ec66c5f6f32b4e21 to your computer and use it in GitHub Desktop.
Save becek2n/14bf42d8b76617b5ec66c5f6f32b4e21 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
class StepTwoView extends StatefulWidget {
StepTwoView({Key key}) : super(key: key);
@override
_StepTwoViewState createState() => _StepTwoViewState();
}
class _StepTwoViewState extends State<StepTwoView>{
Widget _myListView(BuildContext context) {
// backing data
final listData = ['Data 1', 'Data 2', 'Data 3', 'Data 4', 'Data 5', 'Data 6'];
return ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
),
shrinkWrap: true,
itemCount: listData.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(listData[index]),
);
},
);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(10.0),
child: Card(child: Column(
children: <Widget>[
_myListView(context)
]
),)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment