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 #26

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/Utils/constants.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';

const primaryColor = Colors.purple;
const primaryColor = Color.fromRGBO(114, 5, 213, 1);
const secondaryColor = Color.fromRGBO(114, 5, 213, 1);
const lunchColor = Color.fromRGBO(227, 4, 37, 1);
const textStyle = TextStyle(color: Colors.white);
const pdfPathAndroid = "storage/emulated/0/Easy Scan";
4 changes: 3 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'EasyScan',
theme: ThemeData(
primaryColor: primaryColor,
primaryColor: secondaryColor,
backgroundColor: Colors.white38,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: HomeScreen(),
Expand Down
17 changes: 10 additions & 7 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:EasyScan/Utils/constants.dart';
import 'package:EasyScan/screens/images_to_pdf.dart';
import 'package:EasyScan/screens/scan_and_convert.dart';
import 'package:EasyScan/widgets/home_card.dart';
Expand All @@ -14,24 +13,28 @@ class _HomeScreenState extends State<HomeScreen> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: primaryColor,
title: const Text("Easy Scan"),
title: const Text(
"Easy Scan",
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold, fontSize: 24),
),
centerTitle: true,
),
body: Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [
SizedBox(
height: MediaQuery.of(context).size.longestSide * 0.2,
),
HomeCard(
onTap: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => ScanAndConvert())),
iconData: Icons.image_search,
color: Colors.red,
text: 'Scan and convert',
text: 'Scan and Convert',
),
HomeCard(
onTap: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => ImageToPdf())),
iconData: Icons.picture_as_pdf_outlined,
color: Colors.green,
text: 'Scan and convert',
text: 'Pick and Export',
),
// This widget is needed to be implemented for recent projects
// Expanded(
Expand Down
92 changes: 56 additions & 36 deletions lib/screens/images_to_pdf.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:io';
import 'package:EasyScan/Utils/constants.dart';
import 'package:EasyScan/Utils/methods.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
Expand Down Expand Up @@ -32,49 +33,68 @@ class _ImageToPdfState extends State<ImageToPdf> {
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
(_images.isNotEmpty)
? exportPdf(_images)
: showDialog(
context: context,
builder: (BuildContext context) {
return SimpleDialog(
title: const Text("Please select some images first."),
children: [
SimpleDialogOption(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text("OK"),
)
],
);
});
},
icon: const Icon(Icons.upload_file),
label: const Text('Export'),
floatingActionButton: Padding(
padding: const EdgeInsets.all(16.0),
child: FloatingActionButton.extended(
onPressed: () {
(_images.isNotEmpty)
? exportPdf(_images)
: showDialog(
context: context,
builder: (BuildContext context) {
return SimpleDialog(
title: const Text("Please select some images first."),
children: [
SimpleDialogOption(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text("OK"),
)
],
);
});
},
backgroundColor: secondaryColor,
splashColor: lunchColor,
elevation: 8.0,
icon: const Icon(Icons.upload_file),
label: const Text(
'Export',
style: TextStyle(
color: Colors.white, fontSize: 12, fontWeight: FontWeight.w700),
),
),
),
appBar: AppBar(
title: const Text('Choose Image'),
title: const Text(
'Choose Image',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
actions: [
IconButton(
icon: const Icon(Icons.add), onPressed: getImageFromGallery)
],
),
body: Column(
children: [
CheckboxListTile(
title: const Text('Crop Image'),
value: _cropImage,
onChanged: (crop) {
setState(() {
_cropImage = crop;
});
}),
Expanded(child: _buildImageList(context)),
//TODO:make ui better
],
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
],
),
),
);
}
Expand Down
12 changes: 10 additions & 2 deletions lib/screens/scan_and_convert.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:io';
import 'package:EasyScan/Utils/constants.dart';
import 'package:EasyScan/Utils/methods.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
Expand All @@ -11,7 +12,10 @@ class ScanAndConvert extends StatefulWidget {
class _ScanAndConvertState extends State<ScanAndConvert> {
Widget get getBody {
if (_imageFile == null) {
return const Center(child: CircularProgressIndicator());
return const Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(secondaryColor),
));
} else {
return Image.file(_imageFile);
}
Expand Down Expand Up @@ -42,7 +46,11 @@ class _ScanAndConvertState extends State<ScanAndConvert> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Image to convert'),
backgroundColor: primaryColor,
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: secondaryColor),
alignment: Alignment.center,
height: MediaQuery.of(context).size.height / 6,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Icon(
iconData,
color: Colors.white,
size: 50,
),
Text(
text,
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 25,
),
),
),
],
],
),
),
),
);
Expand Down