add print qr code page

This commit is contained in:
tzw
2024-02-26 17:26:25 +06:30
parent a3dd9f35fb
commit c06da8a60c
9 changed files with 112 additions and 23 deletions

View File

@@ -1,13 +1,11 @@
import 'package:fcs/domain/entities/carton.dart';
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/carton/model/carton_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import '../../../helpers/pdf.dart';
import '../carton_info.dart';
import '../print_qr_code_page.dart';
class CartonListRow extends StatelessWidget {
final Carton box;
@@ -68,7 +66,12 @@ class CartonListRow extends StatelessWidget {
const SizedBox(width: 15),
IconButton(
onPressed: () {
_pdf(box, context);
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) =>
PrintQrCodePage(carton: box)),
);
},
icon:
Icon(AntDesign.qrcode, color: Colors.black))
@@ -107,11 +110,4 @@ class CartonListRow extends StatelessWidget {
),
);
}
_pdf(Carton carton, BuildContext context) async {
Carton? c = await context.read<CartonModel>().getCarton(carton.id!);
if (c == null) return;
generateCartonPdf(c);
}
}

View File

@@ -1,11 +1,14 @@
import 'package:fcs/domain/entities/carton.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:intl/intl.dart';
import '../print_qr_code_page.dart';
class CartonRow extends StatelessWidget {
final Carton box;
CartonRow({Key? key, required this.box}) : super(key: key);
final Carton carton;
CartonRow({Key? key, required this.carton}) : super(key: key);
final double dotSize = 15.0;
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
@@ -23,25 +26,34 @@ class CartonRow extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 5.0),
child: new Row(
children: <Widget>[
new Text(box.cartonNumber ?? "",
new Text(carton.cartonNumber ?? "",
style:
new TextStyle(fontSize: 15.0, color: Colors.black)),
const SizedBox(width: 15),
IconButton(onPressed: () {}, icon: Icon(AntDesign.qrcode)),
IconButton(
onPressed: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) =>
PrintQrCodePage(carton: carton)),
);
},
icon: Icon(AntDesign.qrcode)),
],
),
),
),
Column(
children: <Widget>[
box.cartonWeight == 0
carton.cartonWeight == 0
? Container()
: Padding(
padding: const EdgeInsets.only(left: 8.0, bottom: 5),
child: Row(
children: <Widget>[
new Text(
"${box.cartonWeight.toStringAsFixed(2)} lb",
"${carton.cartonWeight.toStringAsFixed(2)} lb",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),