Skip to content

Commit

Permalink
Merge pull request #6 from jspmic/development
Browse files Browse the repository at this point in the history
Solved issue#5
  • Loading branch information
jspmic authored Nov 19, 2024
2 parents eb68a78 + 3b27d72 commit 70f8f6a
Show file tree
Hide file tree
Showing 28 changed files with 446 additions and 357 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Miscellaneous
*.class
*.env
*.log
*.pyc
*.swp
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<application
android:label="Soft"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/launcher_icon">
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
3 changes: 0 additions & 3 deletions android/app/src/main/res/mipmap-anydpi-v26/launcher_icon.xml

This file was deleted.

Binary file removed assets/icon/app-icon.png
Binary file not shown.
Binary file removed assets/icon/drawer.png
Binary file not shown.
Binary file removed assets/icon/logo.JPG
Binary file not shown.
1 change: 1 addition & 0 deletions flutter_jank_metrics_01.json

Large diffs are not rendered by default.

Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 14 additions & 16 deletions lib/custom_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ void initialize({String? district}){
}
list(STOCK_CENTRAL);
list(TYPE_TRANSPORT);
list(PROGRAM);
list(INPUT);
list(DISTRICT);
list(LIVRAISON_RETOUR);
Expand Down Expand Up @@ -70,12 +69,9 @@ class _DatePickerState extends State<DatePicker> {
children: [
OutlinedButton(onPressed: () => _selectDate(context),
style: ElevatedButton.styleFrom(backgroundColor: background),
child: Text("Date",
child: Text(_date == null ? "Date" : "${_date?.day}/${_date?.month}/${_date?.year}",
style: TextStyle(color: background == Colors.white ? Colors.black : Colors.white),
)),
_date == null ? Icon(Icons.date_range, color: background == Colors.white ? Colors.black : Colors.white) : Text("${_date?.day}/${_date?.month}/${_date?.year}",
style: TextStyle(fontSize: 18, color: background == Colors.white ? Colors.black
: Colors.white))
],
),
);
Expand Down Expand Up @@ -105,11 +101,8 @@ class _StockState extends State<Stock> {
super.initState();
if (widget.district != null){
list(DISTRICT+5, district: widget.district);
}
else {
list(widget.column);
}
}
}
}

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -183,16 +176,17 @@ int count=0;

class Boucle extends StatefulWidget {
final String district;
const Boucle({super.key, required this.district});
final List<Widget> boucle;
const Boucle({super.key, required this.boucle, required this.district});

@override
State<Boucle> createState() => _BoucleState();
}

class _BoucleState extends State<Boucle> {
List<Widget> _boucle = [];

void create_boucle(int count){
List<Widget> initBoucle = [];
List<Widget> create_boucle(List<Widget> _boucle, int count){
oneBoucle.add({});
_boucle.add(Stock(hintText: "Livraison Retour",
column: LIVRAISON_RETOUR,
Expand Down Expand Up @@ -235,10 +229,14 @@ class _BoucleState extends State<Boucle> {
},

));
return _boucle;
}
@override
void initState(){
create_boucle(count);
count = 0;
oneBoucle = [];
objLivraison.boucle = {};
initBoucle = create_boucle(initBoucle, count);
super.initState();
}
@override
Expand All @@ -250,13 +248,13 @@ class _BoucleState extends State<Boucle> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
..._boucle,
...initBoucle,
SizedBox(height: 10,),
ElevatedButton(onPressed: (){
setState(() {
livraison.objLivraison.boucle[count.toString()] = oneBoucle[count];
count +=1;
create_boucle(count);
create_boucle(initBoucle, count);
});
},
style: ElevatedButton.styleFrom(backgroundColor: Colors.lightGreen),
Expand Down
122 changes: 85 additions & 37 deletions lib/final_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,57 +39,80 @@ class Final extends StatefulWidget {

class _FinalState extends State<Final> {
Uint8List? _image;
Uint8List? _journal;
int quality = 50;
CompressFormat format=CompressFormat.jpeg;
TextEditingController motif = TextEditingController();

Future<XFile?> fromGallery() async{
Future<XFile?> fromGallery(int src) async {
final imagePicker = ImagePicker();
final pickedFile = await imagePicker.pickImage(source: ImageSource.gallery);
if (pickedFile != null){
final String targetPath = p.join(Directory.systemTemp.path, 'temp.${format.name}');
final XFile? compressedImage = await FlutterImageCompress.compressAndGetFile(
if (pickedFile != null) {
final String targetPath = p.join(
Directory.systemTemp.path, 'temp.${format.name}');
final XFile? compressedImage = await FlutterImageCompress
.compressAndGetFile(
pickedFile.path,
targetPath,
quality: quality,
format: format
);
Uint8List selectedImage;
if (compressedImage != null) {
selectedImage = File(compressedImage.path).readAsBytesSync();
}
else {
selectedImage = File(pickedFile.path).readAsBytesSync();
}
if (src == 0) {
setState(() {
_image = File(compressedImage.path).readAsBytesSync();
_image = selectedImage;
});
}
else{
_image = File(pickedFile.path).readAsBytesSync();
setState(() {
_journal = selectedImage;
});
}
}
return pickedFile;
}

Future<XFile?> fromCamera() async{
Future<XFile?> fromCamera(int src) async{
final imagePicker = ImagePicker();
final pickedFile = await imagePicker.pickImage(source: ImageSource.camera);
if (pickedFile != null){
final String targetPath = p.join(Directory.systemTemp.path, 'temp.${format.name}');
final XFile? compressedImage = await FlutterImageCompress.compressAndGetFile(
if (pickedFile != null) {
final String targetPath = p.join(
Directory.systemTemp.path, 'temp.${format.name}');
final XFile? compressedImage = await FlutterImageCompress
.compressAndGetFile(
pickedFile.path,
targetPath,
quality: quality,
format: format
);
Uint8List selectedImage;
if (compressedImage != null) {
selectedImage = File(compressedImage.path).readAsBytesSync();
}
else {
selectedImage = File(pickedFile.path).readAsBytesSync();
}
if (src == 0) {
setState(() {
_image = File(compressedImage.path).readAsBytesSync();
_image = selectedImage;
});
}
else{
_image = File(pickedFile.path).readAsBytesSync();
setState(() {
_journal = selectedImage;
});
}
}
return pickedFile;
}

void imagePicker(BuildContext context){
void imagePicker(BuildContext context, int sourceCode){
showModalBottomSheet(backgroundColor: background == Colors.white? Colors.black
: Colors.white, context: context, builder: (builder){
return SizedBox(
Expand All @@ -101,7 +124,7 @@ class _FinalState extends State<Final> {
children: [
Expanded(
child: InkWell(
onTap: () => fromGallery(),
onTap: () => fromGallery(sourceCode),
child: Column(
children: [
Icon(Icons.image_rounded, size: 40, color: background == Colors.white ? Colors.white :
Expand All @@ -114,7 +137,7 @@ class _FinalState extends State<Final> {
),
Expanded(
child: InkWell(
onTap: () => fromCamera(),
onTap: () => fromCamera(sourceCode),
child: Column(
children: [
Icon(Icons.camera_alt, size: 40, color: background == Colors.white ? Colors.white :
Expand Down Expand Up @@ -170,36 +193,39 @@ class _FinalState extends State<Final> {
dividerColor: Colors.lightGreen,
)
),
title: "Finalisation",
title: "Soft",
home: Scaffold(
backgroundColor: background,
appBar: AppBar(
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(onPressed: (){
Navigator.pushNamed(context, '/second');
Navigator.popUntil(context, (route){
return route.settings.name == "/second";
});
}, icon: Icon(Icons.redo_rounded, color: Colors.black)),
IconButton(onPressed: (){
Navigator.pushNamed(context, '/');
}, icon: Icon(Icons.logout, color: Colors.black)
),
],
),
centerTitle: true,
backgroundColor: Colors.lightGreen,
),
body:
SingleChildScrollView(
child:
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
Navigator.popUntil(context, (route){
return route.isFirst;
});
}, icon: Icon(Icons.logout, color: Colors.black))
],
),
centerTitle: true,
backgroundColor: Colors.lightGreen,
),
body:
SingleChildScrollView(
child:
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 10),
Stock(hintText: "Stock Central Retour",
column: STOCK_CENTRAL,
background: background, onSelect: (value){
SizedBox(height: 10),
Stock(hintText: "Stock Central Retour",
column: STOCK_CENTRAL,
background: background, onSelect: (value){
objLivraison != null ? objLivraison?.stock_central_retour = value
: objtransf?.stock_central_retour = value;
}),
Expand All @@ -217,6 +243,9 @@ class _FinalState extends State<Final> {
hintText: "Motif...",
),
)),
//Divider(),
SizedBox(height: 10.0),
Text("Photo du mouvement"),
Padding(
padding: const EdgeInsets.all(30.0),
child: Row(
Expand All @@ -226,8 +255,24 @@ class _FinalState extends State<Final> {
CircleAvatar(
radius: 80, backgroundImage: MemoryImage(_image!),
)
: const CircleAvatar(radius: 80,),
IconButton(onPressed: () => imagePicker(context), icon: const Icon(Icons.add_photo_alternate)),
: const CircleAvatar(radius: 80),
IconButton(onPressed: () => imagePicker(context, 0), icon: const Icon(Icons.add_photo_alternate)),
],
)),
//Divider(height: 20.0),
SizedBox(height: 10.0),
Text("Photo du journal du camion"),
Padding(
padding: const EdgeInsets.all(30.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_journal != null ?
CircleAvatar(
radius: 80, backgroundImage: MemoryImage(_journal!),
)
: const CircleAvatar(radius: 80),
IconButton(onPressed: () => imagePicker(context, 1), icon: const Icon(Icons.add_photo_alternate)),
],
),
),
Expand All @@ -236,8 +281,11 @@ class _FinalState extends State<Final> {
objLivraison?.motif = motif.text;
objtransf?.motif = motif.text;
String imageB64 = base64Encode(_image!.toList());
String journalB64 = base64Encode(_journal!.toList());
objtransf?.photo_mvt = imageB64;
objtransf?.photo_journal = journalB64;
objLivraison?.photo_mvt = imageB64;
objLivraison?.photo_journal = journalB64;
save(objtransf: objtransf, objlivraison: objLivraison);
},
style: ElevatedButton.styleFrom(backgroundColor: Colors.lightGreen), child: Text("Enregistrer",
Expand Down
1 change: 0 additions & 1 deletion lib/guard/auth_guard.dart

This file was deleted.

10 changes: 7 additions & 3 deletions lib/livraison.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ import 'package:soft/final_page.dart' as final_page;
late Color? background;
late Color? fieldcolor;
late Livraison objLivraison;
late List<Widget> boucle;

class ScreenTransition{
late Color? backgroundColor;
late Color? fieldColor;
late Livraison objlivraison;
late List<Widget> boucleFromScreen2;
ScreenTransition({required this.backgroundColor, required this.fieldColor,
required this.objlivraison}){
required this.objlivraison, required this.boucleFromScreen2}){
background = backgroundColor;
fieldcolor = fieldColor;
objLivraison = objlivraison;
boucle = boucleFromScreen2;
}
}

Expand All @@ -29,11 +32,12 @@ class LivraisonScreen extends StatefulWidget {
class _LivraisonScreenState extends State<LivraisonScreen> {
@override
Widget build(BuildContext context){
oneBoucle = [];
return MaterialApp(
theme: ThemeData(
colorScheme: background == Colors.white ? const ColorScheme.light(primary: Colors.lightGreen)
: const ColorScheme.dark(primary: Colors.lightGreen)),
title: "Livraison",
title: "Soft",
home: Scaffold(
backgroundColor: background,
appBar: AppBar(title: const Text("Livraison", style: TextStyle(color: Colors.black),),
Expand All @@ -42,7 +46,7 @@ class _LivraisonScreenState extends State<LivraisonScreen> {
),
body: SingleChildScrollView(child: Column(
children: [
Boucle(district: objLivraison.district),
Boucle(boucle: boucle, district: objLivraison.district),
ElevatedButton(onPressed: (){},
style: ElevatedButton.styleFrom(backgroundColor: Colors.lightGreen),
child: IconButton(onPressed: (){
Expand Down
Loading

0 comments on commit 70f8f6a

Please sign in to comment.