add photo design doing

This commit is contained in:
vignesh 2022-06-22 12:17:52 +05:30
parent fea1032a9e
commit cab829ecc2
4 changed files with 61 additions and 41 deletions

View File

@ -486,9 +486,7 @@ void BottomSheets(BuildContext context) {
height: 20, height: 20,
width: 20, width: 20,
), ),
SizedBox( SizedBox(width: 15),
width: 15,
),
Text('Non-Veg'), Text('Non-Veg'),
Spacer(), Spacer(),
Column( Column(

View File

@ -1,7 +1,10 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:dotted_border/dotted_border.dart'; import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/services.dart';
import 'package:image_picker/image_picker.dart';
import '11_busiesshome.dart';
import '25-addphotos1.dart'; import '25-addphotos1.dart';
import 'FontFamily.dart'; import 'FontFamily.dart';
import 'colors.dart'; import 'colors.dart';
@ -15,6 +18,19 @@ class addphotos extends StatefulWidget {
} }
class _addphtosState extends State<addphotos> { class _addphtosState extends State<addphotos> {
File? image;
Future pickImage() async {
try {
final image = await ImagePicker().pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemporary = File(image.path);
setState(() => this.image = imageTemporary);
} on PlatformException catch (e) {
print('failed to pick image:$e');
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -63,10 +79,15 @@ class _addphtosState extends State<addphotos> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () => pickImage(),
Navigator.pop(context); child: image != null
}, ? Image.file(
child: DottedBorder( image!,
width: 330,
height: 100,
fit: BoxFit.cover,
)
: DottedBorder(
dashPattern: [5, 5, 5, 5], dashPattern: [5, 5, 5, 5],
color: primaryColor, color: primaryColor,
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
@ -78,8 +99,8 @@ class _addphtosState extends State<addphotos> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image( Image(
image: image: AssetImage(
AssetImage('assets/images/gallery-icon.png'), 'assets/images/gallery-icon.png'),
color: primaryColor, color: primaryColor,
width: 30, width: 30,
height: 30, height: 30,

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'FontFamily.dart'; import 'FontFamily.dart';
import 'colors.dart'; import 'colors.dart';
import 'fontsize.dart'; import 'fontsize.dart';

View File

@ -32,7 +32,6 @@ dependencies:
snippet_coder_utils: ^1.0.8 snippet_coder_utils: ^1.0.8
dotted_border: ^2.0.0+2 dotted_border: ^2.0.0+2
flutter_switch: ^0.3.2 flutter_switch: ^0.3.2
image_picker: ^0.8.5+3
# The following adds the Cupertino Icons fonts to your application. # The following adds the Cupertino Icons fonts to your application.
@ -42,6 +41,9 @@ dependencies:
intl_phone_number_input: ^0.7.0+2 intl_phone_number_input: ^0.7.0+2
get: ^4.5.1 get: ^4.5.1
smooth_page_indicator: ^1.0.0+2 smooth_page_indicator: ^1.0.0+2
image_picker: ^0.8.5+3