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,
width: 20,
),
SizedBox(
width: 15,
),
SizedBox(width: 15),
Text('Non-Veg'),
Spacer(),
Column(

View File

@ -1,7 +1,10 @@
import 'dart:io';
import 'package:flutter/material.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 'FontFamily.dart';
import 'colors.dart';
@ -15,6 +18,19 @@ class addphotos extends StatefulWidget {
}
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
Widget build(BuildContext context) {
return Scaffold(
@ -63,10 +79,15 @@ class _addphtosState extends State<addphotos> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
onTap: () {
Navigator.pop(context);
},
child: DottedBorder(
onTap: () => pickImage(),
child: image != null
? Image.file(
image!,
width: 330,
height: 100,
fit: BoxFit.cover,
)
: DottedBorder(
dashPattern: [5, 5, 5, 5],
color: primaryColor,
padding: EdgeInsets.all(5),
@ -78,8 +99,8 @@ class _addphtosState extends State<addphotos> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image(
image:
AssetImage('assets/images/gallery-icon.png'),
image: AssetImage(
'assets/images/gallery-icon.png'),
color: primaryColor,
width: 30,
height: 30,

View File

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

View File

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