85 lines
2.4 KiB
Dart
85 lines
2.4 KiB
Dart
import 'package:aman_kassa_flutter/core/logger.dart';
|
|
import 'package:aman_kassa_flutter/redux/actions/setting_actions.dart';
|
|
import 'package:aman_kassa_flutter/redux/store.dart';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart' hide Image;
|
|
import 'package:flutter/rendering.dart';
|
|
|
|
import 'package:logger/logger.dart';
|
|
|
|
import '../data/settings_envi.dart';
|
|
|
|
|
|
class PrinterPaperView extends StatefulWidget {
|
|
PrinterPaperView({Key? key, this.title}) : super(key: key);
|
|
final String? title;
|
|
|
|
@override
|
|
_PrinterEncodingViewState createState() => _PrinterEncodingViewState();
|
|
|
|
}
|
|
|
|
class _PrinterEncodingViewState extends State<PrinterPaperView> {
|
|
|
|
Logger _logger = getLogger('PrinterEncodingView');
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _selectPaper(String paperSize, BuildContext context, ) async {
|
|
_logger.i(encoding);
|
|
await Redux.store!.dispatch(selectPrinterPaperSizeFromSetting(paperSize));
|
|
Navigator.of(context).pop(false);
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('Выберите ширину ленты'),
|
|
),
|
|
body: ListView.builder(
|
|
itemCount: paperSize.keys.length,
|
|
itemBuilder: (BuildContext _, int index) {
|
|
return InkWell(
|
|
onTap: () => _selectPaper(paperSize.keys.elementAt(index), context),
|
|
child: Column(
|
|
children: <Widget>[
|
|
Container(
|
|
height: 60,
|
|
padding: EdgeInsets.only(left: 10),
|
|
alignment: Alignment.centerLeft,
|
|
child: Row(
|
|
children: <Widget>[
|
|
Icon(Icons.sort_by_alpha_outlined),
|
|
SizedBox(width: 10),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
Text(paperSize.values.elementAt(index)),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Divider(),
|
|
],
|
|
),
|
|
);
|
|
}),
|
|
);
|
|
}
|
|
|
|
} |