login.dart 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. // ignore_for_file: use_build_context_synchronously
  2. import 'package:dio/dio.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:namer_app/footer.dart';
  5. import 'package:namer_app/header.dart';
  6. import 'package:namer_app/service/submit.dart';
  7. class LoginPage extends StatelessWidget {
  8. const LoginPage({super.key});
  9. @override
  10. Widget build(BuildContext context) {
  11. final usernameController = TextEditingController();
  12. final passwordController = TextEditingController();
  13. return Scaffold(
  14. appBar: CustomAppbar(),
  15. backgroundColor: Colors.white,
  16. body: Column(
  17. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  18. children: [
  19. Expanded(
  20. child: Center(
  21. child: Row(
  22. mainAxisAlignment: MainAxisAlignment.center,
  23. children: [
  24. Text(
  25. 'LOGIN',
  26. style: TextStyle(color: Colors.black, fontSize: 48),
  27. ),
  28. ],
  29. )),
  30. ),
  31. Expanded(
  32. child: Column(
  33. children: [
  34. Padding(
  35. padding: const EdgeInsets.all(8.0),
  36. child: SizedBox(
  37. width: 396,
  38. height: 51,
  39. child: TextField(
  40. decoration: InputDecoration(
  41. border: OutlineInputBorder(),
  42. focusedBorder: OutlineInputBorder(
  43. borderRadius: BorderRadius.all(Radius.circular(12)),
  44. borderSide: BorderSide(color: Colors.black)),
  45. enabledBorder: OutlineInputBorder(
  46. borderRadius: BorderRadius.all(Radius.circular(12)),
  47. borderSide: BorderSide(color: Colors.black)),
  48. labelText: 'Enter Username',
  49. labelStyle: TextStyle(color: Colors.black),
  50. filled: true,
  51. fillColor: Colors.white.withOpacity(0.25)),
  52. cursorColor: Colors.black,
  53. style: TextStyle(color: Colors.black),
  54. controller: usernameController,
  55. ),
  56. ),
  57. ),
  58. SizedBox(
  59. width: 396,
  60. height: 51,
  61. child: TextField(
  62. obscureText: true,
  63. decoration: InputDecoration(
  64. border: OutlineInputBorder(),
  65. focusedBorder: OutlineInputBorder(
  66. borderRadius: BorderRadius.all(Radius.circular(12)),
  67. borderSide: BorderSide(color: Colors.black)),
  68. enabledBorder: OutlineInputBorder(
  69. borderRadius: BorderRadius.all(Radius.circular(12)),
  70. borderSide: BorderSide(color: Colors.black)),
  71. labelText: 'Enter Password',
  72. labelStyle: TextStyle(color: Colors.black),
  73. filled: true,
  74. fillColor: Colors.white.withOpacity(0.25)),
  75. cursorColor: Colors.black,
  76. style: TextStyle(color: Colors.black),
  77. controller: passwordController,
  78. ),
  79. ),
  80. Padding(
  81. padding: const EdgeInsets.all(20.0),
  82. child: SizedBox(
  83. width: 396,
  84. height: 61,
  85. child: ElevatedButton(
  86. onPressed: () => submit(context, usernameController.text, passwordController.text),
  87. style: ElevatedButton.styleFrom(
  88. backgroundColor: Colors.black, //todo putih lage
  89. side: BorderSide(color: Colors.white),
  90. shape: RoundedRectangleBorder(
  91. borderRadius: BorderRadius.circular(12.0),
  92. ),
  93. ),
  94. child: Text(
  95. 'Login',
  96. style: TextStyle(color: Colors.white),
  97. ),
  98. ),
  99. ),
  100. ),
  101. ],
  102. )),
  103. ],
  104. ),
  105. bottomNavigationBar: Footer(),
  106. );
  107. }
  108. }