feat: server key page
This commit is contained in:
parent
06bf0d7987
commit
15b27d8f67
@ -1,3 +1,6 @@
|
||||
import 'package:enaklo_pos/core/components/components.dart';
|
||||
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||
import 'package:enaklo_pos/presentation/setting/widgets/settings_title.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:enaklo_pos/core/constants/colors.dart';
|
||||
import 'package:enaklo_pos/data/datasources/auth_local_datasource.dart';
|
||||
@ -36,37 +39,64 @@ class _ServerKeyPageState extends State<ServerKeyPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Save Server Key'),
|
||||
centerTitle: true,
|
||||
),
|
||||
//textfield untuk input server key
|
||||
backgroundColor: AppColors.background,
|
||||
body: Column(
|
||||
children: [
|
||||
SettingsTitle('Server Key'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: TextField(
|
||||
controller: serverKeyController,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Server Key',
|
||||
),
|
||||
),
|
||||
),
|
||||
//button untuk save server key
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
AuthLocalDataSource()
|
||||
.saveMidtransServerKey(serverKeyController!.text);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Server Key saved'),
|
||||
backgroundColor: AppColors.primary,
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Server Key',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.black,
|
||||
),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
TextField(
|
||||
controller: serverKeyController,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
hintText: 'Server Key',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Text('Save'),
|
||||
const SpaceHeight(20),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Button.filled(
|
||||
width: context.deviceWidth * 0.2,
|
||||
height: 44,
|
||||
onPressed: () {
|
||||
AuthLocalDataSource()
|
||||
.saveMidtransServerKey(serverKeyController!.text);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Server Key saved'),
|
||||
backgroundColor: AppColors.primary,
|
||||
),
|
||||
);
|
||||
},
|
||||
label: 'Simpan',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -33,6 +33,7 @@ class SettingsTitle extends StatelessWidget {
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user