Skip to content

Commit

Permalink
Add Print layout screen
Browse files Browse the repository at this point in the history
  • Loading branch information
sukso96100 committed Jul 9, 2024
1 parent 3b2a007 commit 421b739
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 9 deletions.
119 changes: 119 additions & 0 deletions lib/settings/printLayout.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import 'dart:async';
import 'dart:convert';
import 'dart:ui' as ui;
import 'dart:io';
import 'dart:io' show Platform;

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

class PrintLayoutSettings extends StatefulWidget {
const PrintLayoutSettings({Key? key}) : super(key: key);
@override
_PrintLayoutSettingsState createState() => _PrintLayoutSettingsState();
}

class _PrintLayoutSettingsState extends State<PrintLayoutSettings> {
@override
void initState() {
super.initState();
print('initState is called');
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('인쇄 레이아웃'),
),
body: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
padding: const EdgeInsets.all(16.0),
child: Text("높이 및 너비(단위: mm)"))
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ConstrainedBox(
constraints: BoxConstraints(maxWidth: 300),
child: Container(
padding: const EdgeInsets.all(16.0),
child: TextField(
style: TextStyle(fontSize: 20),
keyboardType: TextInputType.number,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: '너비 (mm)',
),
onChanged: (value) => {},
))),
ConstrainedBox(
constraints: BoxConstraints(maxWidth: 300),
child: Container(
padding: const EdgeInsets.all(16.0),
child: TextField(
style: TextStyle(fontSize: 20),
keyboardType: TextInputType.number,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: '높이 (mm)',
),
onChanged: (value) => {},
))),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
padding: const EdgeInsets.all(16.0),
child: Text("해상도(단위: DPI)"))
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ConstrainedBox(
constraints: BoxConstraints(maxWidth: 300),
child: Container(
padding: const EdgeInsets.all(16.0),
child: TextField(
style: TextStyle(fontSize: 20),
keyboardType: TextInputType.number,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: '해상도 (DPI)',
),
onChanged: (value) => {},
))),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
padding: const EdgeInsets.all(16.0),
child: OutlinedButton(
onPressed: () async {
var resultSnackBar = SnackBar(
content: Text(
"행사 관계자를 호출 하였습니다. Event staff has been called."),
);
ScaffoldMessenger.of(context)
.showSnackBar(resultSnackBar);
},
child: Text(
"설정 저장",
style: TextStyle(fontSize: 20),
))),
],
),
],
));
}
}
25 changes: 16 additions & 9 deletions lib/settings/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:yaru/icons.dart';

import 'wifiScreen.dart';
import 'printerChooser.dart';
import 'printLayout.dart';

class Settings extends StatelessWidget {
const Settings({
Expand Down Expand Up @@ -31,19 +32,25 @@ class Settings extends StatelessWidget {
onTap: () => Navigator.pop(context, 'Close'),
),
),
length: 2,
length: 3,
tileBuilder: (context, index, selected, availableWidth) {
if (index == 0) {
return YaruMasterTile(title: Text('Wi-Fi Setup'));
} else {
return YaruMasterTile(title: Text('프린터 선택'));
switch (index) {
case 0:
return YaruMasterTile(title: Text('Wi-Fi Setup'));
case 1:
return YaruMasterTile(title: Text('프린터 선택'));
default:
return YaruMasterTile(title: Text('인쇄 레이아웃'));
}
},
pageBuilder: (context, index) {
if (index == 0) {
return WifiScreen();
} else {
return PrinterChooser();
switch (index) {
case 0:
return WifiScreen();
case 1:
return PrinterChooser();
default:
return PrintLayoutSettings();
}
},
),
Expand Down

0 comments on commit 421b739

Please sign in to comment.