flutter_profile/example/lib/utils/example_profile_data.dart
Bart Ribbers eda3a928cd fix: only accept nullable strings when building items for an itemlist
The value is put directly in a TextEditingController so it needs to be a string,
any other value has to be parsed to a string by the user first.
2025-04-04 15:56:16 +02:00

50 lines
940 B
Dart

// SPDX-FileCopyrightText: 2022 Iconica
//
// SPDX-License-Identifier: BSD-3-Clause
import 'package:flutter/material.dart';
import 'package:flutter_profile/flutter_profile.dart';
class ExampleProfileData extends ProfileData {
ExampleProfileData({
this.email,
this.about,
this.remarks,
});
String? email;
String? about;
String? remarks;
@override
Map<String, Widget?> mapWidget(
VoidCallback update,
BuildContext context,
) {
return {
'email': null,
'about': null,
'remarks': null,
};
}
@override
ProfileData fromMap(Map<String, dynamic> data) {
return ExampleProfileData(
email: data['email'],
about: data['about'],
remarks: data['remarks'],
);
}
@override
Map<String, String?> toMap() {
return {'email': email, 'about': about, 'remarks': remarks};
}
@override
ProfileData create() {
return ExampleProfileData();
}
}