Advertisement
Nisanth-Reddy

code

May 19th, 2021
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. class _NewTabState extends State<NewTab> {
  2. List<Dictionary> _users = [];
  3. int len = 0;
  4.  
  5. @override
  6. Widget build(BuildContext context) {
  7. return FutureBuilder<List<Dictionary>>(
  8. future: Services.getUsers(),
  9. builder: (context, AsyncSnapshot<List<Dictionary>> snapshot) {
  10. if (snapshot.data == null) {
  11. return Center(child: CircularProgressIndicator());
  12. } else {
  13. Dictionary user = snapshot.data!.last;
  14. return DefaultTabController(
  15. length: 2,
  16. child: Scaffold(
  17. appBar: AppBar(
  18. title: Text('Meaning',
  19. style: TextStyle(
  20. fontFamily: "Pangolin",
  21. fontSize: 35,
  22. )),
  23. centerTitle: true,
  24. bottom: TabBar(
  25. tabs: <Widget>[
  26. Tab(
  27. text: 'Meaning',
  28. icon: Icon(Icons.book_outlined),
  29. ),
  30. Tab(
  31. text: 'Example',
  32. icon: Icon(Icons.directions_transit)),
  33. ],
  34. ),
  35. ),
  36. body: TabBarView(children: <Widget>[
  37. Container(
  38. color: Colors.white,
  39. child: Container(
  40. color: Colors.black,
  41. child: ListView.builder(
  42. itemCount: user.meanings.length,
  43. itemBuilder: (context, index) {
  44. print(index);
  45. List<Meaning> mean = user.meanings;
  46. return ListTile(
  47. title: Text(
  48. mean[index].definitions[0].definition,
  49. style: TextStyle(
  50. color: Colors.white,
  51. ),
  52. ),
  53. );
  54. },
  55. ),
  56. ),
  57. ),
  58. Container(
  59. child: Text('home'),
  60. ),
  61. ])));
  62. }
  63. },
  64. );
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement