
Flutter Project to Create Invoice PDF Document Template For Products & Payments in Android & IOS For Beginners.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:generate_pdf_invoice_example/page/pdf_page.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
await SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
runApp(MyApp());
}
class MyApp extends StatelessWidget {
static final String title = 'Invoice';
@override
Widget build(BuildContext context) => MaterialApp(
debugShowCheckedModeBanner: false,
title: title,
theme: ThemeData(primarySwatch: Colors.deepOrange),
home: PdfPage(),
);
}import 'package:intl/intl.dart';
class Utils {
static formatPrice(double price) => '\$ ${price.toStringAsFixed(2)}';
static formatDate(DateTime date) => DateFormat.yMd().format(date);
}import 'package:flutter/material.dart';
class ButtonWidget extends StatelessWidget {
final String text;
final VoidCallback onClicked;
const ButtonWidget({
Key? key,
required this.text,
required this.onClicked,
}) : super(key: key);
@override
Widget build(BuildContext context) => ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: Size.fromHeight(40),
),
child: FittedBox(
child: Text(
text,
style: TextStyle(fontSize: 20, color: Colors.white),
),
),
onPressed: onClicked,
);
}import 'package:flutter/material.dart';
class TitleWidget extends StatelessWidget {
final IconData icon;
final String text;
const TitleWidget({
Key? key,
required this.icon,
required this.text,
}) : super(key: key);
@override
Widget build(BuildContext context) => Column(
children: [
Icon(icon, size: 100, color: Colors.white),
const SizedBox(height: 16),
Text(
text,
style: TextStyle(
fontSize: 42,
fontWeight: FontWeight.w400,
color: Colors.white,
),
textAlign: TextAlign.center,
),
],
);
}If you have been searching for the right note-taking or knowledge management app, you have…
Looking for AnyType alternatives? You're not alone. AnyType has gained popularity as a privacy-focused, local-first…
Notion is a popular all-in-one workspace, but many users seek alternatives for different needs (free…
Logseq is a beloved tool in the personal knowledge management (PKM) community. It's free, open-source,…
Looking for a Webshare alternative? You're not alone. Webshare is a popular proxy service with…
Docker changed software development forever. It made containers accessible, gave developers a simple workflow, and…