home.dart 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import 'package:flutter/material.dart';
  2. import 'database.dart';
  3. import 'drawer.dart';
  4. class Home 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 = const TextStyle(
  11. fontWeight: FontWeight.bold,
  12. fontSize: 20,
  13. );
  14. movieData.sort((a, b) => a['movietitle'].compareTo(b['movietitle']));
  15. return Scaffold(
  16. appBar: AppBar(
  17. // The title text which will be shown on the action bar
  18. title: const Center(child: Text("Wes Anderson")),
  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. margin: const EdgeInsets.fromLTRB(0, 0, 0, 10),
  28. child: Row(
  29. // direction: Axis.horizontal,
  30. textDirection: TextDirection.ltr,
  31. children: [
  32. Expanded(
  33. flex: 1,
  34. child: Container(
  35. margin: const EdgeInsets.fromLTRB(0, 0, 10, 0),
  36. child: Image.asset('assets/poster/' +
  37. movieData[point]["postimages"]))),
  38. Expanded(
  39. flex: 1,
  40. child: Column(
  41. crossAxisAlignment: CrossAxisAlignment.start,
  42. children: [
  43. Container(
  44. margin: const EdgeInsets.fromLTRB(0, 0, 2, 2),
  45. child: Text(movieData[point]["movietitle"],
  46. style: text_style)),
  47. Container(
  48. child: Row(
  49. children: [
  50. const Text(
  51. "Release Date",
  52. style: TextStyle(
  53. fontSize: 18,
  54. ),
  55. ),
  56. Text(movieData[point]["releasedate"],
  57. style: const TextStyle(
  58. fontSize: 18,
  59. fontStyle: FontStyle.italic)),
  60. ],
  61. ),
  62. ),
  63. Container(
  64. child: Text(
  65. 'Score' +
  66. movieData[point]["ratings"].toString() +
  67. "%",
  68. style: const TextStyle(
  69. fontSize: 18,
  70. )),
  71. )
  72. ]))
  73. ],
  74. ))
  75. ]),
  76. ); //Scaffold
  77. } //build
  78. }