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,42 +79,47 @@ 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!,
dashPattern: [5, 5, 5, 5], width: 330,
color: primaryColor, height: 100,
padding: EdgeInsets.all(5), fit: BoxFit.cover,
radius: Radius.circular(6), )
child: Container( : DottedBorder(
height: 100, dashPattern: [5, 5, 5, 5],
width: 330, color: primaryColor,
child: Row( padding: EdgeInsets.all(5),
mainAxisAlignment: MainAxisAlignment.center, radius: Radius.circular(6),
children: [ child: Container(
Image( height: 100,
image: width: 330,
AssetImage('assets/images/gallery-icon.png'), child: Row(
color: primaryColor, mainAxisAlignment: MainAxisAlignment.center,
width: 30, children: [
height: 30, Image(
), image: AssetImage(
SizedBox(width: 10), 'assets/images/gallery-icon.png'),
Text( color: primaryColor,
'Upload Photos', width: 30,
style: TextStyle( height: 30,
fontFamily: Font, ),
fontStyle: FontStyle.normal, SizedBox(width: 10),
fontWeight: FontWeight.w400, Text(
fontSize: HeadText, 'Upload Photos',
color: primaryColor, style: TextStyle(
fontFamily: Font,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.w400,
fontSize: HeadText,
color: primaryColor,
),
)
],
), ),
) ),
], ),
),
),
),
), ),
], ],
), ),

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