Skip to content

Commit

Permalink
[Feat] Create display_picture_screen ui (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
kminji127 committed Feb 17, 2023
1 parent 6be7441 commit 25766c9
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/configs/curve_painter.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:i_can_read/configs/color.dart';

class CurvePainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
var paint = Paint();
// set properties to paint
paint.color = ColorPalette.primaryGold;
paint.style = PaintingStyle.fill;

var path = Path();
// draw path
path.moveTo(0, size.height * 0.1);
path.quadraticBezierTo(size.width / 2, size.height / 4, size.width, size.height * 0.1);
path.lineTo(size.width, 0);
path.lineTo(0, 0);

canvas.drawPath(path, paint);
}

@override
bool shouldRepaint(CustomPainter oldDelegate) {
return false;
}
}
75 changes: 75 additions & 0 deletions lib/screens/camera/display_picture_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:i_can_read/configs/color.dart';
import 'package:i_can_read/configs/curve_painter.dart';
import 'package:i_can_read/screens/camera/result_screen.dart';

class DisplayPictureScreen extends StatelessWidget {
final String imagePath;
const DisplayPictureScreen({super.key, required this.imagePath});

@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomPaint(
painter: CurvePainter(),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(color: Colors.black.withOpacity(0.3), blurRadius: 20)
],
),
child: Image.file(File(imagePath),
width: MediaQuery.of(context).size.width * 0.8,
height: MediaQuery.of(context).size.height * 0.6,
fit: BoxFit.cover,
),
),
const SizedBox(height: 50),
ElevatedButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => ResultScreen(),
)
);
},
style: ElevatedButton.styleFrom(
fixedSize: Size(MediaQuery.of(context).size.width * 0.8, 60),
backgroundColor: ColorPalette.primaryGold,
foregroundColor: ColorPalette.black10,
textStyle: const TextStyle(fontSize: 28),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
),
child: const Text('메뉴 분석'),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
Navigator.of(context).pop();
},
style: ElevatedButton.styleFrom(
fixedSize: Size(MediaQuery.of(context).size.width * 0.8, 60),
backgroundColor: ColorPalette.secondaryGold,
foregroundColor: ColorPalette.black40,
textStyle: const TextStyle(fontSize: 28),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
),
child: const Text('다시 찍기'),
),
],
),
),
),
);
}
}

0 comments on commit 25766c9

Please sign in to comment.