Skip to content

Commit

Permalink
update conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Thuyhaile committed Nov 25, 2023
1 parent 833e1a5 commit 72c3b67
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 43 deletions.
74 changes: 44 additions & 30 deletions lib/screens/new_citizen_screen.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -76,6 +77,7 @@ class _NewCitizenScreenState extends State<NewCitizenScreen> {
bool isButtonSaveEnabled = true;
bool isButtonContinueEnabled = false;


@override
Widget build(BuildContext context) {
widget.screenHeight = MediaQuery.of(context).size.height;
Expand All @@ -101,7 +103,7 @@ class _NewCitizenScreenState extends State<NewCitizenScreen> {
border:
const OutlineInputBorder(borderSide: BorderSide()),
labelText: 'Navn',
errorText: (snapshot?.data == true) &&
errorText: (snapshot.data == true) &&
widget._bloc.displayNameController.value != null
? null
: 'Navn skal udfyldes',
Expand Down Expand Up @@ -129,9 +131,9 @@ class _NewCitizenScreenState extends State<NewCitizenScreen> {
leading: Radio<Roles>(
value: Roles.guardian,
groupValue: _role,
onChanged: (Roles value) {
onChanged: (Roles? value) {
setState(() {
_role = value;
_role = value!;
widget._bloc.onUsePictogramPasswordChange
.add(value == Roles.citizen);
});
Expand All @@ -146,9 +148,9 @@ class _NewCitizenScreenState extends State<NewCitizenScreen> {
leading: Radio<Roles>(
value: Roles.trustee,
groupValue: _role,
onChanged: (Roles value) {
onChanged: (Roles? value) {
setState(() {
_role = value;
_role = value!;
widget._bloc.onUsePictogramPasswordChange
.add(value == Roles.citizen);
});
Expand All @@ -163,9 +165,9 @@ class _NewCitizenScreenState extends State<NewCitizenScreen> {
leading: Radio<Roles>(
value: Roles.citizen,
groupValue: _role,
onChanged: (Roles value) {
onChanged: (Roles? value) {
setState(() {
_role = value;
_role = value!;
});
},
),
Expand All @@ -189,7 +191,7 @@ class _NewCitizenScreenState extends State<NewCitizenScreen> {
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
Expand Down Expand Up @@ -238,17 +240,17 @@ class _NewCitizenScreenState extends State<NewCitizenScreen> {
builder:
(BuildContext context, AsyncSnapshot<bool> 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
Expand All @@ -269,11 +271,11 @@ class _NewCitizenScreenState extends State<NewCitizenScreen> {
(BuildContext context, AsyncSnapshot<bool> 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
Expand All @@ -300,13 +302,16 @@ class _NewCitizenScreenState extends State<NewCitizenScreen> {

/// Profile preview picture
Center(
child: StreamBuilder<File>(
stream: widget._bloc.file,
builder:
(BuildContext context, AsyncSnapshot<File> snapshot) =>
snapshot.data != null
? widget._displayImage(snapshot.data)
: widget._displayIfNoImage()),
child: StreamBuilder<File?>(
stream: widget._bloc.file,
builder: (BuildContext context, AsyncSnapshot<File?> 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(
Expand All @@ -320,16 +325,22 @@ class _NewCitizenScreenState extends State<NewCitizenScreen> {
/// 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<File>(
stream: widget._bloc.file,
builder: (BuildContext context,
AsyncSnapshot<File> snapshot) =>
snapshot.data != null
? widget._displayImage(snapshot.data)
: widget._displayIfNoImage()),
AsyncSnapshot<File?> 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();
}),
),
),
],
Expand Down Expand Up @@ -410,10 +421,13 @@ class _NewCitizenScreenState extends State<NewCitizenScreen> {
MaterialPageRoute<void>(
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) ??
<int>[],
)
)));
},
),
Expand Down
75 changes: 63 additions & 12 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module:
androidX: true

environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=3.1.2"
dependencies:
api_client:
git:
Expand Down

0 comments on commit 72c3b67

Please sign in to comment.