Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ui changes branch #30

Merged
merged 13 commits into from
Oct 12, 2020
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug **
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.


**Smartphone (please complete the following information):**
- Device: [e.g. Pixel 3]
- OS: [e.g. iOS8.1]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
3 changes: 2 additions & 1 deletion lib/Utils/constants.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';

const primaryColor = Colors.purple;
const primaryColor = Color.fromRGBO(114, 5, 210, 1);
const secondaryColor = Color.fromRGBO(227, 4, 37, 1);
const textStyle = TextStyle(color: Colors.white);
const pdfPathAndroid = "storage/emulated/0/Easy Scan";
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'EasyScan',
theme: ThemeData(
appBarTheme: const AppBarTheme(color: primaryColor),
Expand Down
53 changes: 27 additions & 26 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,36 @@ class _HomeScreenState extends State<HomeScreen> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Easy Scan"),
title: const Text(
"Easy Scan",
style: TextStyle(
fontSize: 24, fontWeight: FontWeight.bold, color: Colors.white),
),
centerTitle: true,
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
HomeCard(
onTap: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => ScanAndConvert())),
iconData: Icons.image_search,
color: Colors.red,
text: 'Scan and convert',
),
HomeCard(
onTap: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => ImageToPdf())),
iconData: Icons.picture_as_pdf_outlined,
color: Colors.green,
text: 'Images to Pdf',
),
HomeCard(
onTap: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => SavedPdfScreen())),
iconData: Icons.save_rounded,
color: Colors.amber,
text: 'History',
),
],
),
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
HomeCard(
onTap: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => ScanAndConvert())),
iconData: Icons.image_search,
text: 'Scan and convert',
),
HomeCard(
onTap: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => ImageToPdf())),
iconData: Icons.picture_as_pdf_outlined,
text: 'Images to Pdf',
),
HomeCard(
onTap: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => SavedPdfScreen())),
iconData: Icons.save_rounded,
text: 'History',
),
]),
);
}
}
88 changes: 50 additions & 38 deletions lib/screens/images_to_pdf.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import 'dart:io';
import 'package:flutter/material.dart';

import 'package:EasyScan/Utils/constants.dart';
import 'package:EasyScan/Utils/methods.dart';

import 'package:flutter/material.dart';

import 'package:image_picker/image_picker.dart';

class ImageToPdf extends StatefulWidget {
Expand Down Expand Up @@ -32,46 +36,54 @@ class _ImageToPdfState extends State<ImageToPdf> {
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (_images.isNotEmpty)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: FloatingActionButton.extended(
heroTag: 'export',
onPressed: () => exportPdf(_images),
icon: const Icon(Icons.upload_file),
label: const Text('Export'),
backgroundColor: Colors.green,
floatingActionButton: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (_images.isNotEmpty)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: FloatingActionButton.extended(
heroTag: 'export',
onPressed: () => exportPdf(_images),
icon: const Icon(Icons.upload_file),
label: const Text('Export'),
backgroundColor: Colors.green,
),
),
FloatingActionButton.extended(
heroTag: 'addimg',
onPressed: getImageFromGallery,
icon: const Icon(Icons.add),
label: const Text('Add image'),
),
FloatingActionButton.extended(
heroTag: 'addimg',
onPressed: getImageFromGallery,
icon: const Icon(Icons.add),
label: const Text('Add image'),
],
),
appBar: AppBar(
title: const Text(
'Choose Image',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
CheckboxListTile(
checkColor: secondaryColor,
title: const Text('Crop Image',
style:
TextStyle(fontSize: 20, fontWeight: FontWeight.w500)),
value: _cropImage,
onChanged: (crop) {
setState(() {
_cropImage = crop;
});
}),
Expanded(child: _buildImageList(context)),
//TODO:make ui better
],
),
],
),
appBar: AppBar(
title: const Text('Images to Pdf'),
),
body: Column(
children: [
CheckboxListTile(
title: const Text('Crop Image'),
value: _cropImage,
onChanged: (crop) {
setState(() {
_cropImage = crop;
});
}),
Expanded(child: _buildImageList(context)),
//TODO:make ui better
],
),
);
));
}

Widget _buildImageList(BuildContext context) {
Expand Down
17 changes: 14 additions & 3 deletions lib/screens/scan_and_convert.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import 'dart:io';
import 'package:flutter/material.dart';

import 'package:EasyScan/Utils/constants.dart';
import 'package:EasyScan/Utils/methods.dart';

import 'package:flutter/material.dart';

import 'package:image_picker/image_picker.dart';

class ScanAndConvert extends StatefulWidget {
Expand All @@ -21,7 +25,10 @@ class _ScanAndConvertState extends State<ScanAndConvert> {
);
}
if (_imageFile == null) {
return const Center(child: CircularProgressIndicator());
return const Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(primaryColor),
));
} else {
return Image.file(_imageFile);
}
Expand Down Expand Up @@ -53,7 +60,11 @@ class _ScanAndConvertState extends State<ScanAndConvert> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Image to convert'),
backgroundColor: primaryColor,
cimplesid marked this conversation as resolved.
Show resolved Hide resolved
title: const Text(
'Image to convert',
style: TextStyle(color: Colors.white),
),
),
body: getBody,
);
Expand Down
46 changes: 24 additions & 22 deletions lib/widgets/home_card.dart
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
import 'package:EasyScan/Utils/constants.dart';
import 'package:flutter/material.dart';

class HomeCard extends StatelessWidget {
final Color color;
final String text;
final IconData iconData;
final Function onTap;
const HomeCard(
{Key key, @required this.text, this.color, this.iconData, this.onTap})
const HomeCard({Key key, @required this.text, this.iconData, this.onTap})
: super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
padding: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20), color: Colors.grey[200]),
alignment: Alignment.center,
height: MediaQuery.of(context).size.height / 6,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Icon(
iconData,
color: color,
size: 50,
),
Expanded(
child: Text(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
padding: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20), color: primaryColor),
alignment: Alignment.center,
height: MediaQuery.of(context).size.height / 6,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Icon(
iconData,
color: Colors.white,
size: 50,
),
Text(
cimplesid marked this conversation as resolved.
Show resolved Hide resolved
text,
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 25,
),
),
),
],
],
),
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
google_fonts: ^1.1.0
image_cropper: ^1.3.0
image_picker: ^0.6.7+4
open_file: ^3.0.1
open_file:
pdf: ^1.10.0
permission_handler: ^5.0.1+1

Expand Down