top.dart 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 = new 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. new Container(
  27. child: new Flex(
  28. direction: Axis.horizontal,
  29. textDirection: TextDirection.ltr,
  30. children: [
  31. new Expanded(
  32. flex: 1,
  33. child: new Container(
  34. child: Image.asset('assets/poster/' +
  35. movieData[point]["postimages"]),
  36. margin: EdgeInsets.fromLTRB(0, 0, 10, 0))),
  37. new Expanded(
  38. flex: 1,
  39. child: new Column(
  40. crossAxisAlignment: CrossAxisAlignment.start,
  41. children: [
  42. new Container(
  43. child: Text(
  44. movieData[point]["ratings"].toString() +"%:"+
  45. movieData[point]["movietitle"],
  46. style: text_style),
  47. margin: EdgeInsets.fromLTRB(0, 0, 2, 2)),
  48. new Container(
  49. child: Row(
  50. children: [
  51. Text(
  52. "Release Date",
  53. style: TextStyle(
  54. fontSize: 18,
  55. ),
  56. ),
  57. Text(movieData[point]["releasedate"],
  58. style: TextStyle(
  59. fontSize: 18,
  60. fontStyle: FontStyle.italic)),
  61. ],
  62. ),
  63. ),
  64. ]))
  65. ],
  66. ),
  67. margin: EdgeInsets.fromLTRB(0, 0, 0, 10))
  68. ]),
  69. ); //Scaffold
  70. } //build
  71. }