Compare commits

..

No commits in common. "master" and "1.4.0" have entirely different histories.

12 changed files with 568 additions and 56 deletions

7
.gitignore vendored
View file

@ -23,7 +23,7 @@ migrate_working_dir/
# Flutter/Dart/Pub related # Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
pubspec.lock /pubspec.lock
**/doc/api/ **/doc/api/
.dart_tool/ .dart_tool/
.packages .packages
@ -37,8 +37,3 @@ example/windows/
example/web/ example/web/
.flutter-plugins .flutter-plugins
.flutter-plugins-dependencies .flutter-plugins-dependencies
.metadata
# FVM Version Cache
.fvm/
.fvmrc

10
.metadata Normal file
View file

@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
channel: stable
project_type: package

View file

@ -1,11 +1,3 @@
## 1.6.0
* Upgraded flutter_input_library to 3.6.0
## 1.5.0
- Updated flutter_input_library to 3.2.1
- Added the option to give a `BoxFit` to the avatar image
## 1.4.0 ## 1.4.0
- Added CONTRIBUTING.md, documentation and updated flutter_input_library to 3.2.1 - Added CONTRIBUTING.md, documentation and updated flutter_input_library to 3.2.1

45
example/.metadata Normal file
View file

@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.
version:
revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
channel: stable
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
- platform: android
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
- platform: ios
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
- platform: linux
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
- platform: macos
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
- platform: web
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
- platform: windows
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'

View file

@ -17,7 +17,7 @@ class ExampleProfileData extends ProfileData {
String? remarks; String? remarks;
@override @override
Map<String, Widget?> mapWidget( Map<String, dynamic> mapWidget(
VoidCallback update, VoidCallback update,
BuildContext context, BuildContext context,
) { ) {
@ -38,7 +38,7 @@ class ExampleProfileData extends ProfileData {
} }
@override @override
Map<String, String?> toMap() { Map<String, dynamic> toMap() {
return {'email': email, 'about': about, 'remarks': remarks}; return {'email': email, 'about': about, 'remarks': remarks};
} }

461
example/pubspec.lock Normal file
View file

@ -0,0 +1,461 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.11.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
cached_network_image:
dependency: transitive
description:
name: cached_network_image
sha256: "28ea9690a8207179c319965c13cd8df184d5ee721ae2ce60f398ced1219cea1f"
url: "https://pub.dev"
source: hosted
version: "3.3.1"
cached_network_image_platform_interface:
dependency: transitive
description:
name: cached_network_image_platform_interface
sha256: "9e90e78ae72caa874a323d78fa6301b3fb8fa7ea76a8f96dc5b5bf79f283bf2f"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
cached_network_image_web:
dependency: transitive
description:
name: cached_network_image_web
sha256: "42a835caa27c220d1294311ac409a43361088625a4f23c820b006dd9bffb3316"
url: "https://pub.dev"
source: hosted
version: "1.1.1"
characters:
dependency: transitive
description:
name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
clock:
dependency: transitive
description:
name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.dev"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.18.0"
crypto:
dependency: transitive
description:
name: crypto
sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67
url: "https://pub.dev"
source: hosted
version: "3.0.2"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be
url: "https://pub.dev"
source: hosted
version: "1.0.5"
fake_async:
dependency: transitive
description:
name: fake_async
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
url: "https://pub.dev"
source: hosted
version: "1.3.1"
ffi:
dependency: transitive
description:
name: ffi
sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978
url: "https://pub.dev"
source: hosted
version: "2.0.1"
file:
dependency: transitive
description:
name: file
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
url: "https://pub.dev"
source: hosted
version: "6.1.4"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba"
url: "https://pub.dev"
source: hosted
version: "3.3.1"
flutter_input_library:
dependency: transitive
description:
path: "."
ref: "3.2.1"
resolved-ref: fddf100fb0aaeff3d6171f58c403d811fab80346
url: "https://github.com/Iconica-Development/flutter_input_library"
source: git
version: "3.2.1"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c
url: "https://pub.dev"
source: hosted
version: "2.0.1"
flutter_profile:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "1.4.0"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: transitive
description:
name: http
sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482"
url: "https://pub.dev"
source: hosted
version: "0.13.5"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.dev"
source: hosted
version: "4.0.2"
intl:
dependency: transitive
description:
name: intl
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
url: "https://pub.dev"
source: hosted
version: "0.18.1"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
url: "https://pub.dev"
source: hosted
version: "10.0.0"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
url: "https://pub.dev"
source: hosted
version: "2.0.1"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
url: "https://pub.dev"
source: hosted
version: "2.0.1"
lints:
dependency: transitive
description:
name: lints
sha256: "5cfd6509652ff5e7fe149b6df4859e687fca9048437857cb2e65c8d780f396e3"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
matcher:
dependency: transitive
description:
name: matcher
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev"
source: hosted
version: "1.11.0"
octo_image:
dependency: transitive
description:
name: octo_image
sha256: "45b40f99622f11901238e18d48f5f12ea36426d8eced9f4cbf58479c7aa2430d"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
path:
dependency: transitive
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
path_provider:
dependency: transitive
description:
name: path_provider
sha256: "050e8e85e4b7fecdf2bb3682c1c64c4887a183720c802d323de8a5fd76d372dd"
url: "https://pub.dev"
source: hosted
version: "2.0.11"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: a776c088d671b27f6e3aa8881d64b87b3e80201c64e8869b811325de7a76c15e
url: "https://pub.dev"
source: hosted
version: "2.0.22"
path_provider_ios:
dependency: transitive
description:
name: path_provider_ios
sha256: "03d639406f5343478352433f00d3c4394d52dac8df3d847869c5e2333e0bbce8"
url: "https://pub.dev"
source: hosted
version: "2.0.11"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379
url: "https://pub.dev"
source: hosted
version: "2.1.7"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
sha256: "2a97e7fbb7ae9dcd0dfc1220a78e9ec3e71da691912e617e8715ff2a13086ae8"
url: "https://pub.dev"
source: hosted
version: "2.0.6"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
sha256: f0abc8ebd7253741f05488b4813d936b4d07c6bae3e86148a09e342ee4b08e76
url: "https://pub.dev"
source: hosted
version: "2.0.5"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c
url: "https://pub.dev"
source: hosted
version: "2.1.3"
platform:
dependency: transitive
description:
name: platform
sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a
url: "https://pub.dev"
source: hosted
version: "2.1.3"
process:
dependency: transitive
description:
name: process
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
url: "https://pub.dev"
source: hosted
version: "4.2.4"
rxdart:
dependency: transitive
description:
name: rxdart
sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb"
url: "https://pub.dev"
source: hosted
version: "0.27.7"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
sqflite:
dependency: transitive
description:
name: sqflite
sha256: d21c022832f139b89922738e200c07387a49c549bf36c35654418e19ff76d161
url: "https://pub.dev"
source: hosted
version: "2.2.0+3"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
sha256: "0c21a187d645aa65da5be6997c0c713eed61e049158870ae2de157e6897067ab"
url: "https://pub.dev"
source: hosted
version: "2.4.0+2"
stack_trace:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.2"
string_scanner:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
synchronized:
dependency: transitive
description:
name: synchronized
sha256: "7b530acd9cb7c71b0019a1e7fa22c4105e675557a4400b6a401c71c5e0ade1ac"
url: "https://pub.dev"
source: hosted
version: "3.0.0+3"
term_glyph:
dependency: transitive
description:
name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.dev"
source: hosted
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5"
url: "https://pub.dev"
source: hosted
version: "1.3.1"
uuid:
dependency: transitive
description:
name: uuid
sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313"
url: "https://pub.dev"
source: hosted
version: "3.0.7"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
url: "https://pub.dev"
source: hosted
version: "13.0.0"
win32:
dependency: transitive
description:
name: win32
sha256: d13ac5deea7327f027b3b97ee19ee210f68256ecf3f1a304bcfb992ee947637c
url: "https://pub.dev"
source: hosted
version: "3.1.1"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
sha256: "11541eedefbcaec9de35aa82650b695297ce668662bbd6e3911a7fabdbde589f"
url: "https://pub.dev"
source: hosted
version: "0.2.0+2"
sdks:
dart: ">=3.2.0-0 <4.0.0"
flutter: ">=3.10.0"

View file

@ -76,9 +76,9 @@ abstract class ProfileData {
ProfileData fromMap(Map<String, dynamic> data); ProfileData fromMap(Map<String, dynamic> data);
Map<String, String?> toMap(); Map<String, dynamic> toMap();
Map<String, Widget?> mapWidget(VoidCallback update, BuildContext context); Map<String, dynamic> mapWidget(VoidCallback update, BuildContext context);
ProfileData create(); ProfileData create();
} }

View file

@ -12,7 +12,6 @@ class Avatar extends StatelessWidget {
this.user, this.user,
this.size = 100, this.size = 100,
this.avatarBackgroundColor, this.avatarBackgroundColor,
this.boxfit = BoxFit.contain,
}); });
/// The user object containing user information. /// The user object containing user information.
@ -24,8 +23,6 @@ class Avatar extends StatelessWidget {
/// Background color of the avatar. /// Background color of the avatar.
final Color? avatarBackgroundColor; final Color? avatarBackgroundColor;
final BoxFit boxfit;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var imageProvider = _getImageProvider(user); var imageProvider = _getImageProvider(user);
@ -45,7 +42,7 @@ class Avatar extends StatelessWidget {
image: hasImage image: hasImage
? DecorationImage( ? DecorationImage(
image: imageProvider, image: imageProvider,
fit: boxfit, fit: BoxFit.contain,
) )
: null, : null,
), ),

View file

@ -19,14 +19,14 @@ class ItemBuilder {
Widget build( Widget build(
String key, String key,
String? value, value,
Widget? widget, Widget? widget,
void Function(String) updateItem, Function(String) updateItem,
void Function(String?) saveItem, Function(String?) saveItem,
) { ) {
if (widget == null) { if (widget == null) {
var controller = TextEditingController( var controller = TextEditingController(
text: value ?? '', text: '${value ?? ''}',
); );
var inputDecoration = var inputDecoration =
@ -55,7 +55,7 @@ class ItemBuilder {
Widget buildPassword( Widget buildPassword(
String key, String key,
TextEditingController controller, TextEditingController controller,
void Function(String?) onChanged, Function(String?) onChanged,
String? Function(String?) validator, String? Function(String?) validator,
) { ) {
var inputDecoration = var inputDecoration =

View file

@ -16,39 +16,49 @@ class ItemList {
this.itemBuilder, this.itemBuilder,
this.itemBuilderOptions, this.itemBuilderOptions,
}) { }) {
var itemBuilder = this.itemBuilder ?? builder; for (var item in items.entries) {
widgets.addAll({
widgets = { item.key: itemBuilder == null
for (var item in items.entries) ...{ ? builder.build(
item.key: itemBuilder.build( item.key,
item.key, item.value,
item.value, typeMap[item.key],
typeMap[item.key], (value) {
(value) { saveProfile();
saveProfile(); },
}, (value) {
(value) { updateProfile(item.key, value);
updateProfile(item.key, value); },
}, )
), : itemBuilder!.build(
}, item.key,
}; item.value,
typeMap[item.key],
(value) {
saveProfile();
},
(value) {
updateProfile(item.key, value);
},
),
});
}
} }
/// Gets the map of item keys and their corresponding widgets. /// Gets the map of item keys and their corresponding widgets.
Map<String, Widget> getItemList() => widgets; Map<String, Widget> getItemList() => widgets;
/// Map containing item keys and their values. /// Map containing item keys and their values.
final Map<String, String?> items; final Map<String, dynamic> items;
/// Map containing item keys and their types. /// Map containing item keys and their types.
final Map<String, Widget?> typeMap; final Map<String, dynamic> typeMap;
/// Function to update the profile with a specific item's value. /// Function to update the profile with a specific item's value.
final void Function(String, String?) updateProfile; final Function(String, String?) updateProfile;
/// Function to save the profile after an item value is updated. /// Function to save the profile after an item value is updated.
final void Function() saveProfile; final Function() saveProfile;
/// Builder for custom item widgets. /// Builder for custom item widgets.
final ItemBuilder? itemBuilder; final ItemBuilder? itemBuilder;
@ -60,7 +70,7 @@ class ItemList {
final GlobalKey<FormState> formKey; final GlobalKey<FormState> formKey;
/// Map containing item keys and their corresponding widgets. /// Map containing item keys and their corresponding widgets.
late final Map<String, Widget> widgets; Map<String, Widget> widgets = {};
/// `builder` is an instance of `ItemBuilder` which is used /// `builder` is an instance of `ItemBuilder` which is used
/// to build the items in the list. /// to build the items in the list.

View file

@ -1,19 +1,21 @@
name: flutter_profile name: flutter_profile
description: Flutter profile package description: Flutter profile package
version: 1.6.0 version: 1.4.0
repository: https://github.com/Iconica-Development/flutter_profile repository: https://github.com/Iconica-Development/flutter_profile
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub publish_to: none
environment: environment:
sdk: ">=3.0.0 <4.0.0" sdk: ^3.0.0
flutter: ">=1.17.0" flutter: ">=1.17.0"
dependencies: dependencies:
cached_network_image: ^3.3.0 cached_network_image: ^3.3.0
flutter_input_library: flutter_input_library:
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub git:
version: ^3.6.0 url: https://github.com/Iconica-Development/flutter_input_library
ref: 3.2.1
flutter: flutter:
sdk: flutter sdk: flutter

View file

@ -13,7 +13,7 @@ class TestProfileData extends ProfileData {
String? email; String? email;
@override @override
Map<String, Widget?> mapWidget( Map<String, dynamic> mapWidget(
VoidCallback update, VoidCallback update,
BuildContext context, BuildContext context,
) => ) =>
@ -27,7 +27,7 @@ class TestProfileData extends ProfileData {
); );
@override @override
Map<String, String?> toMap() => { Map<String, dynamic> toMap() => {
'email': email, 'email': email,
}; };