top.dart 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import 'package:flutter/material.dart';
  2. import 'database.dart';
  3. import 'drawer.dart';
  4. class Top extends StatelessWidget {
  5. // The indexes of each array match the assigned recipe.
  6. // DO NOT loop through each of these individually
  7. // to generate the recipes.
  8. @override
  9. Widget build(BuildContext context) {
  10. var text_style = TextStyle(
  11. fontWeight: FontWeight.bold,
  12. fontSize: 20,
  13. );
  14. movieData.sort((a, b) => a['ratings'].compareTo(b['ratings']));
  15. return Scaffold(
  16. appBar: AppBar(
  17. // The title text which will be shown on the action bar
  18. title: Center(child: Text("Top Rated")),
  19. ),
  20. drawer: Container(
  21. color: Colors.grey,
  22. child: AppDrawer(),
  23. ), //Appbar
  24. body: ListView(children: [
  25. for (var point = 0; point < movieData.length; point++)
  26. Container(
  27. child: Flex(
  28. direction: Axis.horizontal,
  29. textDirection: TextDirection.ltr,
  30. children: [
  31. Expanded(
  32. flex: 1,
  33. child: Container(
  34. child: Image.asset('assets/poster/' +
  35. movieData[point]["postimages"]),
  36. margin: EdgeInsets.fromLTRB(0, 0, 10, 0))),
  37. Expanded(
  38. flex: 1,
  39. child: Column(
  40. crossAxisAlignment: CrossAxisAlignment.start,
  41. children: [
  42. Container(
  43. child: Text(
  44. movieData[point]["ratings"].toString() +
  45. "%:" +
  46. movieData[point]["movietitle"],
  47. style: text_style),
  48. margin: EdgeInsets.fromLTRB(0, 0, 2, 2)),
  49. Container(
  50. child: Row(
  51. children: [
  52. Text(
  53. "Release Date",
  54. style: TextStyle(
  55. fontSize: 18,
  56. ),
  57. ),
  58. Text(movieData[point]["releasedate"],
  59. style: TextStyle(
  60. fontSize: 18,
  61. fontStyle: FontStyle.italic)),
  62. ],
  63. ),
  64. ),
  65. ]))
  66. ],
  67. ),
  68. margin: EdgeInsets.fromLTRB(0, 0, 0, 10))
  69. ]),
  70. ); //Scaffold
  71. } //build
  72. }