From 72c3b67d2ff4c1ce6bbcc98fd91055c7d83230c8 Mon Sep 17 00:00:00 2001 From: Thuyhaile <95319419+Thuyhaile@users.noreply.github.com> Date: Sat, 25 Nov 2023 11:48:13 +0100 Subject: [PATCH] update conflict --- lib/screens/new_citizen_screen.dart | 74 ++++++++++++++++------------ pubspec.lock | 75 ++++++++++++++++++++++++----- pubspec.yaml | 2 +- 3 files changed, 108 insertions(+), 43 deletions(-) diff --git a/lib/screens/new_citizen_screen.dart b/lib/screens/new_citizen_screen.dart index c1fbfcc83..b5292b4b8 100644 --- a/lib/screens/new_citizen_screen.dart +++ b/lib/screens/new_citizen_screen.dart @@ -1,4 +1,5 @@ import 'dart:io'; +import 'dart:typed_data'; import 'package:api_client/models/giraf_user_model.dart'; import 'package:auto_size_text/auto_size_text.dart'; @@ -76,6 +77,7 @@ class _NewCitizenScreenState extends State { bool isButtonSaveEnabled = true; bool isButtonContinueEnabled = false; + @override Widget build(BuildContext context) { widget.screenHeight = MediaQuery.of(context).size.height; @@ -101,7 +103,7 @@ class _NewCitizenScreenState extends State { border: const OutlineInputBorder(borderSide: BorderSide()), labelText: 'Navn', - errorText: (snapshot?.data == true) && + errorText: (snapshot.data == true) && widget._bloc.displayNameController.value != null ? null : 'Navn skal udfyldes', @@ -129,9 +131,9 @@ class _NewCitizenScreenState extends State { leading: Radio( value: Roles.guardian, groupValue: _role, - onChanged: (Roles value) { + onChanged: (Roles? value) { setState(() { - _role = value; + _role = value!; widget._bloc.onUsePictogramPasswordChange .add(value == Roles.citizen); }); @@ -146,9 +148,9 @@ class _NewCitizenScreenState extends State { leading: Radio( value: Roles.trustee, groupValue: _role, - onChanged: (Roles value) { + onChanged: (Roles? value) { setState(() { - _role = value; + _role = value!; widget._bloc.onUsePictogramPasswordChange .add(value == Roles.citizen); }); @@ -163,9 +165,9 @@ class _NewCitizenScreenState extends State { leading: Radio( value: Roles.citizen, groupValue: _role, - onChanged: (Roles value) { + onChanged: (Roles? value) { setState(() { - _role = value; + _role = value!; }); }, ), @@ -189,7 +191,7 @@ class _NewCitizenScreenState extends State { border: const OutlineInputBorder(borderSide: BorderSide()), labelText: 'Brugernavn', - errorText: (snapshot?.data == true) && + errorText: (snapshot.data == true) && widget._bloc.usernameController.value != null ? null // cant make it shorter because of the string @@ -238,17 +240,17 @@ class _NewCitizenScreenState extends State { builder: (BuildContext context, AsyncSnapshot snapshot) { return Visibility( - visible: !widget._bloc. - usePictogramPasswordController.value, + visible: + !widget._bloc.usePictogramPasswordController.value!, child: TextFormField( key: const Key('passwordField'), enabled: - !widget._bloc.usePictogramPasswordController.value, + !widget._bloc.usePictogramPasswordController.value!, decoration: InputDecoration( border: const OutlineInputBorder(borderSide: BorderSide()), labelText: 'Kodeord', - errorText: (snapshot?.data == true) && + errorText: (snapshot.data == true) && widget._bloc.passwordController.value != null ? null // cant make it shorter because of the string @@ -269,11 +271,11 @@ class _NewCitizenScreenState extends State { (BuildContext context, AsyncSnapshot snapshot) { return Visibility( visible: - !widget._bloc.usePictogramPasswordController.value, + !widget._bloc.usePictogramPasswordController.value!, child: TextFormField( key: const Key('passwordVerifyField'), enabled: - !widget._bloc.usePictogramPasswordController.value, + !widget._bloc.usePictogramPasswordController.value!, decoration: InputDecoration( border: const @@ -300,13 +302,16 @@ class _NewCitizenScreenState extends State { /// Profile preview picture Center( - child: StreamBuilder( - stream: widget._bloc.file, - builder: - (BuildContext context, AsyncSnapshot snapshot) => - snapshot.data != null - ? widget._displayImage(snapshot.data) - : widget._displayIfNoImage()), + child: StreamBuilder( + stream: widget._bloc.file, + builder: (BuildContext context, AsyncSnapshot snapshot) { + final File? fileData = + snapshot.data; // Store the data in a local variable + return fileData != null + ? widget._displayImage(fileData) // Use the local variable + : widget._displayIfNoImage(); + }, + ), ), Row( @@ -320,16 +325,22 @@ class _NewCitizenScreenState extends State { /// Add from gallery button child: GirafButton( key: const Key('TilføjFraGalleriButton'), - icon: const ImageIcon(AssetImage('assets/icons/gallery.png')), + icon: + const ImageIcon(AssetImage('assets/icons/gallery.png')), + text: 'Tilføj fra galleri', onPressed: widget._bloc.chooseImageFromGallery, child: StreamBuilder( stream: widget._bloc.file, builder: (BuildContext context, - AsyncSnapshot snapshot) => - snapshot.data != null - ? widget._displayImage(snapshot.data) - : widget._displayIfNoImage()), + AsyncSnapshot snapshot) { + final File? fileData = snapshot + .data; // Store the data in a local variable + return fileData != null + ? widget._displayImage( + fileData) // Use the local variable + : widget._displayIfNoImage(); + }), ), ), ], @@ -410,10 +421,13 @@ class _NewCitizenScreenState extends State { MaterialPageRoute( builder: (BuildContext context) => NewPictogramPasswordScreen( - widget._bloc.usernameController.value, - widget._bloc.displayNameController.value, - widget._bloc.encodePicture( - widget._bloc.fileController.value), + widget._bloc.usernameController.value!, + widget._bloc.displayNameController.value!, + Uint8List.fromList( + widget._bloc.encodePicture(widget + ._bloc.fileController.value) ?? + [], + ) ))); }, ), diff --git a/pubspec.lock b/pubspec.lock index aaf25a167..ae87e2793 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -163,9 +163,12 @@ packages: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.18.0" + connectivity: dependency: transitive description: @@ -451,9 +454,12 @@ packages: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.10.0" + mime: dependency: transitive description: @@ -687,14 +693,28 @@ packages: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" + stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted version: "2.1.0" string_scanner: @@ -722,9 +742,20 @@ packages: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.6.1" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + tuple: dependency: transitive description: @@ -759,7 +790,25 @@ packages: name: watcher url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + win32: dependency: transitive description: @@ -789,5 +838,7 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.18.0 <3.0.0" - flutter: ">=3.3.0" + + dart: ">=3.2.0-194.0.dev <4.0.0" + flutter: ">=3.7.0" + diff --git a/pubspec.yaml b/pubspec.yaml index 5414b72e1..f70a78a82 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ module: androidX: true environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=3.1.2" dependencies: api_client: git: