listuser.dart 2.6 KB

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