listuser.dart 2.4 KB

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