Skip to content

Commit

Permalink
Picker
Browse files Browse the repository at this point in the history
  • Loading branch information
fcraveiro committed Feb 5, 2022
1 parent fe300e9 commit 63c410d
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 40 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Gradle = gradle:7.0.4' distribution = gradle-7.0.2-all.zip </br>
<tr>
<td><img alt="" src="https://user-images.githubusercontent.com/31604881/152596164-5cff9d95-1735-4f27-8bf5-afb4bfa6b779.png" style="width: 340px; height: 530px;" /></td>
<td><img alt="" src="https://user-images.githubusercontent.com/31604881/152617239-e4513285-2ba6-4270-833e-d74dcbff03ca.png" style="width: 340px; height: 530px;" /></td>
</tr>

<td><img alt="" src="https://user-images.githubusercontent.com/31604881/152654072-54f397d4-54c7-4c6b-b160-e635a9181c87.png" style="width: 340px; height: 530px;" /></td> </tr>
</tbody>
</table>
95 changes: 83 additions & 12 deletions lib/testes/pickernovo.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import 'dart:developer';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:image_picker/image_picker.dart';

class Picker2 extends StatefulWidget {
const Picker2({Key? key}) : super(key: key);
Expand All @@ -8,23 +14,88 @@ class Picker2 extends StatefulWidget {
}

class _Picker2State extends State<Picker2> {
File? image;

Future pickImage(source) async {
try {
final image = await ImagePicker().pickImage(source: source);
if (image == null) return;
final imageTemporary = File(image.path);
setState(() {
this.image = imageTemporary;
});
} on PlatformException catch (e) {
log('Falha $e');
}
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('picker'),
title: const Text('Imagem para o Histórico'),
centerTitle: true,
backgroundColor: const Color(0xFF48426D),
),
body: Column(
children: [
ElevatedButton(
onPressed: () {},
child: const Text('Foto'),
),
ElevatedButton(
onPressed: () {},
child: const Text('Galeria'),
),
],
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const SizedBox(
height: 60,
),
image != null
? Image.file(
image!,
width: 300,
height: 340,
fit: BoxFit.cover,
)
: const FlutterLogo(
size: 160,
),
const SizedBox(
height: 60,
),
ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 7,
fixedSize: const Size(220, 40),
primary: const Color(0xFF48426D),
onSurface: Colors.black,
),
onPressed: () {
pickImage(ImageSource.camera);
},
child: Text(
'Fotos',
style: GoogleFonts.nunito(
fontSize: 18,
),
),
),
const SizedBox(
height: 20,
),
ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 7,
fixedSize: const Size(220, 40),
primary: const Color(0xFF48426D),
onSurface: Colors.black,
),
onPressed: () {
pickImage(ImageSource.gallery);
},
child: Text(
'Galeria',
style: GoogleFonts.nunito(
fontSize: 18,
),
),
),
],
),
),
);
}
Expand Down
16 changes: 8 additions & 8 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
fake_async:
dependency: transitive
description:
Expand Down Expand Up @@ -252,6 +245,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
meta:
dependency: transitive
description:
Expand Down Expand Up @@ -487,7 +487,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.3"
version: "0.4.8"
toggle_switch:
dependency: "direct main"
description:
Expand Down
40 changes: 22 additions & 18 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,30 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_localizations:
flutter_localizations: # Importante
sdk: flutter
cupertino_icons: ^1.0.2
font_awesome_flutter: ^9.2.0
get: ^4.6.1
get_storage: ^2.0.3
google_fonts: ^2.2.0
supabase: ^0.2.10
oa_fone: ^1.0.2
flutter_slidable: ^1.1.0
mask_text_input_formatter: ^2.0.0
flutter_cache_manager: ^3.3.0
staggered_grid_view_flutter: ^0.0.4
transparent_image: ^2.0.0
toggle_switch: ^1.4.0
flutter_colorpicker: ^1.0.3
via_cep_flutter: ^0.2.2
image_picker: ^0.8.4+6
table_calendar: ^3.0.3
flutter_slidable: ^1.1.0 # Importante
image_picker: ^0.8.4+6 # Importante
table_calendar: ^3.0.3 # Importante

font_awesome_flutter: ^9.2.0 # Basico
get: ^4.6.1 # Basico
get_storage: ^2.0.3 # Basico
google_fonts: ^2.2.0 # Basico
supabase: ^0.2.10 # Basico

oa_fone: ^1.0.2 # Package Propria
via_cep_flutter: ^0.2.2 # Alterar para Propria

flutter_cache_manager: ^3.3.0 # Maquiagem

mask_text_input_formatter: ^2.0.0 # Rever
staggered_grid_view_flutter: ^0.0.4 # Dispensavel
transparent_image: ^2.0.0 # Dispensavel
toggle_switch: ^1.4.0 # Dispensavel
flutter_colorpicker: ^1.0.3 # Dispensavel

#cupertino_icons: ^1.0.2
#image_downloader: ^0.31.0
#lottie: ^1.2.1

Expand Down

0 comments on commit 63c410d

Please sign in to comment.