From 25766c9316af530771a4b6e8964722c24a0f1d2a Mon Sep 17 00:00:00 2001 From: Minji Kim Date: Fri, 17 Feb 2023 17:40:31 +0900 Subject: [PATCH] [Feat] Create display_picture_screen ui (#4) --- lib/configs/curve_painter.dart | 26 +++++++ .../camera/display_picture_screen.dart | 75 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 lib/configs/curve_painter.dart create mode 100644 lib/screens/camera/display_picture_screen.dart diff --git a/lib/configs/curve_painter.dart b/lib/configs/curve_painter.dart new file mode 100644 index 0000000..0ba9a69 --- /dev/null +++ b/lib/configs/curve_painter.dart @@ -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; + } +} \ No newline at end of file diff --git a/lib/screens/camera/display_picture_screen.dart b/lib/screens/camera/display_picture_screen.dart new file mode 100644 index 0000000..004d420 --- /dev/null +++ b/lib/screens/camera/display_picture_screen.dart @@ -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('다시 찍기'), + ), + ], + ), + ), + ), + ); + } +} \ No newline at end of file