Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class _NewTabState extends State<NewTab> {
- List<Dictionary> _users = [];
- int len = 0;
- @override
- Widget build(BuildContext context) {
- return FutureBuilder<List<Dictionary>>(
- future: Services.getUsers(),
- builder: (context, AsyncSnapshot<List<Dictionary>> snapshot) {
- if (snapshot.data == null) {
- return Center(child: CircularProgressIndicator());
- } else {
- Dictionary user = snapshot.data!.last;
- return DefaultTabController(
- length: 2,
- child: Scaffold(
- appBar: AppBar(
- title: Text('Meaning',
- style: TextStyle(
- fontFamily: "Pangolin",
- fontSize: 35,
- )),
- centerTitle: true,
- bottom: TabBar(
- tabs: <Widget>[
- Tab(
- text: 'Meaning',
- icon: Icon(Icons.book_outlined),
- ),
- Tab(
- text: 'Example',
- icon: Icon(Icons.directions_transit)),
- ],
- ),
- ),
- body: TabBarView(children: <Widget>[
- Container(
- color: Colors.white,
- child: Container(
- color: Colors.black,
- child: ListView.builder(
- itemCount: user.meanings.length,
- itemBuilder: (context, index) {
- print(index);
- List<Meaning> mean = user.meanings;
- return ListTile(
- title: Text(
- mean[index].definitions[0].definition,
- style: TextStyle(
- color: Colors.white,
- ),
- ),
- );
- },
- ),
- ),
- ),
- Container(
- child: Text('home'),
- ),
- ])));
- }
- },
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement