Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

feat(capture): check if camera is available before trying to capture #20

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions lib/component/collection_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ class CollectionPreview extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(10),
margin: const EdgeInsets.all(10),
height: 230,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
borderRadius: const BorderRadius.all(
Radius.circular(18),
),
boxShadow: [
BoxShadow(
color: Colors.grey.shade200,
spreadRadius: 4,
blurRadius: 6,
offset: Offset(0, 3),
offset: const Offset(0, 3),
),
],
),
Expand All @@ -29,7 +29,7 @@ class CollectionPreview extends StatelessWidget {
Container(
height: 140,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(18),
topRight: Radius.circular(18),
),
Expand All @@ -45,9 +45,9 @@ class CollectionPreview extends StatelessWidget {
right: -15,
child: MaterialButton(
color: Colors.white,
shape: CircleBorder(),
shape: const CircleBorder(),
onPressed: () {},
child: Icon(
child: const Icon(
Icons.edit_rounded,
size: 20,
),
Expand All @@ -57,7 +57,7 @@ class CollectionPreview extends StatelessWidget {
),
),
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
margin: const EdgeInsets.fromLTRB(10, 10, 10, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expand All @@ -72,7 +72,7 @@ class CollectionPreview extends StatelessWidget {
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 10),
margin: const EdgeInsets.symmetric(horizontal: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expand All @@ -88,28 +88,25 @@ class CollectionPreview extends StatelessWidget {
),
),
Container(
margin: EdgeInsets.fromLTRB(10, 3, 10, 0),
margin: const EdgeInsets.fromLTRB(10, 3, 10, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
DateFormat(DATE_FORMATTER).format(DateTime.parse(
collection.updated != null ?
collection.updated! :
collection.created
)),
collection.updated != null
? collection.updated!
: collection.created)),
style: GoogleFonts.nunito(
fontSize: 14,
color: Colors.grey[500],
fontWeight: FontWeight.w400,
)
)
))
],
),
),
],
),
);
}

}
}
5 changes: 2 additions & 3 deletions lib/component/loader.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:loading_animation_widget/loading_animation_widget.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../constant.dart';

class Loader extends StatelessWidget {
Expand All @@ -16,8 +15,8 @@ class Loader extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: this.shadowBackground ?
Color.fromRGBO(0, 0, 0, 50) :
color: shadowBackground ?
const Color.fromRGBO(0, 0, 0, 50) :
Colors.transparent
,
child: Column(
Expand Down
6 changes: 4 additions & 2 deletions lib/constant.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'dart:io';

import 'package:flutter/material.dart';

const MaterialColor DEFAULT_COLOR = Colors.indigo;
const String API_HOSTNAME = '10.0.2.2:5000';
const bool API_IS_HTTPS = false;
String API_HOSTNAME = Platform.isAndroid ? '10.0.2.2:5000' : '0.0.0.0:5000';
const bool API_IS_HTTPS = false;
3 changes: 2 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
"switchCamera": "Switch camera",
"createSequenceWithPicture_tooltip": "Create a new sequence with captured pictures",
"waitDuringProcessing": "Processing, please wait...",
"noCameraFoundError": "No camera found for this device",

"newSequenceNameField": "Name",
"newSequenceNameField_placeholder": "Enter the new sequence name",
"newSequenceSendButton": "Send"
}
}
3 changes: 2 additions & 1 deletion lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
"switchCamera": "Changer de camera",
"createSequenceWithPicture_tooltip": "Créer une nouvelle séquence avec les photos prises",
"waitDuringProcessing": "Traitement en cours, veuillez patienter...",
"noCameraFoundError": "Pas de caméra trouvée pour cet appareil",

"newSequenceNameField": "Nom",
"newSequenceNameField_placeholder": "Saisissez le nom de la nouvelle séquence",
"newSequenceSendButton": "Envoyer"
}
}
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ part 'service/routing.dart';
part 'service/permission_helper.dart';


final String DATE_FORMATTER = 'dd/MM/y HH:mm:ss';
const String DATE_FORMATTER = 'dd/MM/y HH:mm:ss';

void main() {
runApp(const PanoramaxApp());
Expand Down
Loading