listcomment.dart 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import 'package:flutter/material.dart';
  2. import 'package:namer_app/data/datacomment.dart';
  3. import 'package:namer_app/footer.dart';
  4. import 'package:namer_app/header.dart';
  5. class ListCommentPage extends StatefulWidget {
  6. const ListCommentPage({super.key});
  7. @override
  8. State<ListCommentPage> createState() => _ListCommentPageState();
  9. }
  10. class _ListCommentPageState extends State<ListCommentPage> {
  11. @override
  12. Widget build(BuildContext context) {
  13. return Scaffold(
  14. appBar: CustomAppbar(),
  15. body: Stack(children: [
  16. SingleChildScrollView(
  17. child: Column(
  18. children: [
  19. Center(
  20. child: Row(
  21. mainAxisAlignment: MainAxisAlignment.center,
  22. children: [
  23. Text(
  24. 'LIST COMMENT',
  25. style: TextStyle(color: Colors.black, fontSize: 48),
  26. ),
  27. ],
  28. )),
  29. Column(
  30. children: List.generate(
  31. 4,
  32. (i) => SizedBox(
  33. child: ListTile(
  34. leading: SizedBox(
  35. child: Icon(Icons.chat),
  36. ),
  37. title: Text(comments[i]['comment']),
  38. subtitle: Column(
  39. crossAxisAlignment: CrossAxisAlignment.start,
  40. children: [
  41. Text(comments[i]['created']),
  42. Text(comments[i]['creator'])
  43. ],
  44. ),
  45. trailing: ButtonUser(
  46. items: comments[i],
  47. ),
  48. ),
  49. )),
  50. ),
  51. ],
  52. ),
  53. ),
  54. ]),
  55. bottomNavigationBar: Footer(),
  56. );
  57. }
  58. }
  59. class ButtonUser extends StatelessWidget {
  60. final Map<String, dynamic> items;
  61. ButtonUser({
  62. required this.items,
  63. super.key,
  64. });
  65. //todo tombol item
  66. //todo tombol delete
  67. @override
  68. Widget build(BuildContext context) {
  69. return Row(
  70. mainAxisSize: MainAxisSize.min,
  71. children: [
  72. ElevatedButton(
  73. onPressed: null,
  74. style: ElevatedButton.styleFrom(
  75. backgroundColor: Colors.black,
  76. ),
  77. child: Text(
  78. 'Delete',
  79. style: TextStyle(color: Colors.white),
  80. ),
  81. ),
  82. ],
  83. );
  84. }
  85. }