Login page content

This commit is contained in:
Andrew 2023-05-08 14:04:30 +07:00
parent 12ff1e953a
commit 53320d9d0f
6 changed files with 75 additions and 14 deletions

View file

@ -1,3 +1,4 @@
import 'package:flu_console/flu_console.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
@ -26,7 +27,9 @@ void main() async {
fenix: true,
);
runApp(const MainApp());
FluConsole.run(() {
runApp(const MainApp());
});
}
class MainApp extends StatelessWidget {

View file

@ -1,5 +1,10 @@
import 'package:flutter/services.dart';
import 'package:flu_console/flu_console.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:styled_widget/styled_widget.dart';
import 'package:tuuli_app/api_controller.dart';
import 'package:tuuli_app/pages/home_page.dart';
class SettingsPanel extends StatefulWidget {
const SettingsPanel({super.key});
@ -16,21 +21,53 @@ class _SettingsPanelState extends State<SettingsPanel> {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: IntrinsicHeight(
child: _buildBody(),
),
);
}
Widget _buildBody() {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Settings',
style: Theme.of(context).textTheme.headlineSmall,
),
const Text("Current user access token:")
.textStyle(Get.textTheme.bodySmall!),
[
Text(ApiController.to.token)
.textStyle(Get.textTheme.titleSmall!)
.expanded(),
IconButton(
onPressed: () async {
await Clipboard.setData(
ClipboardData(text: ApiController.to.token),
);
Get.snackbar(
"Copied",
"Token copied to clipboard",
snackPosition: SnackPosition.BOTTOM,
);
},
icon: const Icon(Icons.copy),
),
].toRow(),
const SizedBox(height: 16),
[
TextFormField(
enabled: false,
decoration: const InputDecoration(
labelText: 'Endpoint',
hintText: 'Enter Tuuli Endpoint',
),
initialValue: ApiController.to.endPoint,
).expanded(),
ElevatedButton(
onPressed: () => Get.find<HomePageController>().logout(),
child: const Text("Logout to change"),
)
].toRow(),
const SizedBox(height: 16),
[
ElevatedButton(
onPressed: () => Get.bottomSheet(const LogPrintPanel()),
child: const Text("Show app logs"),
).expanded(),
].toRow(),
],
);
).paddingAll(8);
}
}