86 lines
2.9 KiB
Dart
86 lines
2.9 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:westone_kurirapp/app/constant.dart';
|
|
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
|
import 'package:westone_kurirapp/widget/custom_button.dart';
|
|
|
|
class LoginBox extends HookConsumerWidget {
|
|
const LoginBox({super.key});
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final loading = useState(false);
|
|
final obsecure = useState(true);
|
|
final usernameController = useTextEditingController(text: "");
|
|
final passwordController = useTextEditingController(text: "");
|
|
return Container(
|
|
padding: EdgeInsets.fromLTRB(
|
|
Constant.getActualX(context: context, x: 36),
|
|
Constant.getActualY(context: context, y: 50),
|
|
Constant.getActualX(context: context, x: 36),
|
|
Constant.getActualY(context: context, y: 10)),
|
|
child: ListView(
|
|
children: [
|
|
Text(
|
|
"Selamat Datang!",
|
|
style: Constant.h2(context: context)
|
|
.copyWith(fontWeight: FontWeight.bold),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
Text(
|
|
"Silahkan login untuk mulai bertugas",
|
|
style: Constant.subtitle2(context: context)
|
|
.copyWith(fontWeight: FontWeight.w400),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
SizedBox(
|
|
height: Constant.getActualY(context: context, y: 44),
|
|
),
|
|
TextField(
|
|
controller: usernameController,
|
|
decoration: InputDecoration(
|
|
label: Text(
|
|
"Username",
|
|
style: Constant.subtitle2(context: context),
|
|
),
|
|
filled: true,
|
|
fillColor: Colors.white,
|
|
border: InputBorder.none),
|
|
),
|
|
SizedBox(
|
|
height: Constant.getActualY(context: context, y: 20),
|
|
),
|
|
TextField(
|
|
controller: passwordController,
|
|
obscureText: obsecure.value,
|
|
decoration: InputDecoration(
|
|
label: Text("Password",
|
|
style: Constant.subtitle2(context: context)),
|
|
filled: true,
|
|
fillColor: Colors.white,
|
|
border: InputBorder.none),
|
|
),
|
|
SizedBox(
|
|
height: Constant.getActualY(context: context, y: 30),
|
|
),
|
|
CustomButton(
|
|
text: "LOGIN",
|
|
type: ButtonType.primary,
|
|
onPressed: () {
|
|
// print("aldksld");
|
|
loading.value = true;
|
|
Timer(Duration(seconds: 3), () {
|
|
loading.value = false;
|
|
});
|
|
},
|
|
loading: loading.value,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|