Skip to content

Commit

Permalink
Revamp main page
Browse files Browse the repository at this point in the history
  • Loading branch information
sukso96100 committed Jul 25, 2024
1 parent cc8f6c2 commit 35ffe57
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 60 deletions.
33 changes: 33 additions & 0 deletions lib/clockwidgets.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'dart:async';
import 'dart:io';
import 'package:yaru/yaru.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';

class ClockTimeWidget extends StatelessWidget {
const ClockTimeWidget({super.key});

@override
Widget build(BuildContext context) {
return StreamBuilder(
stream: Stream.periodic(const Duration(seconds: 1)),
builder: (context, snapshot) {
return Text(DateFormat('hh:mm:ss a').format(DateTime.now()));
},
);
}
}

class ClockDateWidget extends StatelessWidget {
const ClockDateWidget({super.key});

@override
Widget build(BuildContext context) {
return StreamBuilder(
stream: Stream.periodic(const Duration(seconds: 1)),
builder: (context, snapshot) {
return Text(DateFormat('yyyy-MM-dd').format(DateTime.now()));
},
);
}
}
126 changes: 66 additions & 60 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import 'dart:io';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:ubuntu_kr_qr_kiosk/printScreen.dart';
import 'package:flutter/widgets.dart';
import 'checkInByEmailScreen.dart';
import 'checkInByBarcodeScreen.dart';
import 'package:yaru/yaru.dart';
import 'kioskclient.dart';
import 'settings/wifiScreen.dart';
import 'settings/settings.dart';
import 'package:google_fonts/google_fonts.dart';
import 'clockwidgets.dart';

void main() {
runApp(const MyApp());
Expand Down Expand Up @@ -128,29 +127,33 @@ class _KioskMainPageState extends State<KioskMainPage> {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.fact_check,
size: 100.0,
semanticLabel: 'Text to announce in accessibility modes',
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"체크인 방법을 선택하세요",
style: TextStyle(fontSize: 40),
)
ConstrainedBox(
constraints: BoxConstraints(maxWidth: 1000, maxHeight: 150),
child: YaruBanner.tile(
surfaceTintColor: YaruColors.orange,
title: Text("환영합니다 | Welcome",
style: TextStyle(fontSize: 40)),
subtitle: Text("체크인 방법을 선택하세요 | Choose Check-in method",
style: TextStyle(fontSize: 20)),
icon: Icon(
YaruIcons.ubuntu_logo_large,
size: 100,
))),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Card(
clipBehavior: Clip.hardEdge,
child: InkWell(
splashColor: Colors.orange.withAlpha(30),
ConstrainedBox(
constraints: BoxConstraints(maxWidth: 500, maxHeight: 200),
child: YaruBanner.tile(
title: Text("QR 코드로 체크인", style: TextStyle(fontSize: 35)),
subtitle: Text("Check-in with QR Code",
style: TextStyle(fontSize: 20)),
icon: Icon(
Icons.qr_code,
size: 100,
),
onTap: () {
Navigator.push(
context,
Expand All @@ -159,20 +162,18 @@ class _KioskMainPageState extends State<KioskMainPage> {
const CheckInByBarcodeScreen()),
);
},
child: Container(
padding: const EdgeInsets.all(30.0),
child: Column(children: [
Icon(
Icons.qr_code_scanner,
size: 100.0,
),
Text("QR 코드", style: TextStyle(fontSize: 40))
])),
)),
Card(
clipBehavior: Clip.hardEdge,
child: InkWell(
splashColor: Colors.orange.withAlpha(30),
ConstrainedBox(
constraints: BoxConstraints(maxWidth: 500, maxHeight: 200),
child: YaruBanner.tile(
title:
Text("이메일 주소로 체크인", style: TextStyle(fontSize: 35)),
subtitle: Text("Check-in with E-Mail Address",
style: TextStyle(fontSize: 20)),
icon: Icon(
YaruIcons.mail_open,
size: 100,
),
onTap: () {
Navigator.push(
context,
Expand All @@ -181,37 +182,42 @@ class _KioskMainPageState extends State<KioskMainPage> {
const CheckInByEmailScreen()),
);
},
child: Container(
padding: const EdgeInsets.all(30.0),
child: Column(children: [
Icon(
YaruIcons.mail_open,
size: 100.0,
),
Text("E-Mail 주소", style: TextStyle(fontSize: 40))
])),
))
)),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
padding: const EdgeInsets.all(8.0),
child: OutlinedButton(
onPressed: () async {
await kioskClient.callStaff();
var resultSnackBar = SnackBar(
content: Text(
"행사 관계자를 호출 하였습니다. Event staff has been called."),
);
ScaffoldMessenger.of(context)
.showSnackBar(resultSnackBar);
},
child: Text(
"관계자 호출 CALL STAFF",
style: TextStyle(fontSize: 30),
))),
ConstrainedBox(
constraints: BoxConstraints(maxWidth: 500, maxHeight: 100),
child: YaruBanner.tile(
title: ClockTimeWidget(),
subtitle: ClockDateWidget(),
icon: Icon(
YaruIcons.clock,
size: 50,
),
)),
ConstrainedBox(
constraints: BoxConstraints(maxWidth: 500, maxHeight: 100),
child: YaruBanner.tile(
surfaceTintColor: YaruColors.orange,
title: Text("관계자 호출"),
subtitle: Text("CALL STAFF"),
icon: Icon(
YaruIcons.light_bulb_on,
size: 50,
),
onTap: () async {
await kioskClient.callStaff();
var resultSnackBar = SnackBar(
content: Text(
"행사 관계자를 호출 하였습니다. Event staff has been called."),
);
ScaffoldMessenger.of(context)
.showSnackBar(resultSnackBar);
},
)),
],
)
],
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.2.0"
intl:
dependency: "direct main"
description:
name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.19.0"
js:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ dependencies:
google_fonts: ^6.2.1
nm: ^0.5.0
screenshot: ^2.5.0
intl: ^0.19.0

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 35ffe57

Please sign in to comment.