Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ build/
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
.vscode/
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## 0.0.8
## 0.0.10

* Fixed onSelect issue on web
* Made truely generic

## 0.0.9

* Fixed onSave issue.

Expand Down
5 changes: 2 additions & 3 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 30
compileSdkVersion 31

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
minSdkVersion 16
targetSdkVersion 30
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
1 change: 1 addition & 0 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
Expand Down
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.7.10'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
96 changes: 56 additions & 40 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,37 @@ class MyHomePage extends StatefulWidget {
}

class _MyHomePageState extends State<MyHomePage> {
final List<Map<String, dynamic>> _roles = [
{"name": "Super Admin", "desc": "Having full access rights", "role": 1},
{
"name": "Admin",
"desc": "Having full access rights of a Organization",
"role": 2
},
{
"name": "Manager",
"desc": "Having Magenent access rights of a Organization",
"role": 3
},
{
"name": "Technician",
"desc": "Having Technician Support access rights",
"role": 4
},
{
"name": "Customer Support",
"desc": "Having Customer Support access rights",
"role": 5
},
{"name": "User", "desc": "Having End User access rights", "role": 6},
final List<UserRole> _roles = [
UserRole(
"Super Admin",
"Having full access rights",
1,
),
UserRole(
"Admin",
"Having full access rights of a Organization",
2,
),
UserRole(
"Manager",
"Having Management access rights of a Organization",
3,
),
UserRole(
"Technician",
"Having Technician Support access rights",
4,
),
UserRole(
"Customer Support",
"Having Customer Support access rights",
5,
),
UserRole(
"User",
"Having End User access rights",
6,
),
];

@override
Expand All @@ -70,35 +78,35 @@ class _MyHomePageState extends State<MyHomePage> {
SizedBox(
height: 16,
),
DropdownFormField<Map<String, dynamic>>(
DropdownFormField<UserRole>(
onEmptyActionPressed: () async {},
decoration: InputDecoration(
border: OutlineInputBorder(),
suffixIcon: Icon(Icons.arrow_drop_down),
labelText: "Access"),
onSaved: (dynamic str) {},
onChanged: (dynamic str) {},
validator: (dynamic str) {},
displayItemFn: (dynamic item) => Text(
(item ?? {})['name'] ?? '',
onSaved: (role) {},
onChanged: (role) {},
validator: (role) {
return null;
},
displayItemFn: (item) => Text(
item?.name ?? '',
style: TextStyle(fontSize: 16),
),
findFn: (dynamic str) async => _roles,
selectedFn: (dynamic item1, dynamic item2) {
findFn: (str) async => _roles,
selectedFn: (item1, item2) {
if (item1 != null && item2 != null) {
return item1['name'] == item2['name'];
return item1.name == item2.name;
}
return false;
},
filterFn: (dynamic item, str) =>
item['name'].toLowerCase().indexOf(str.toLowerCase()) >= 0,
dropdownItemFn: (dynamic item, int position, bool focused,
bool selected, Function() onTap) =>
filterFn: (item, str) =>
item.name.toLowerCase().indexOf(str.toLowerCase()) >= 0,
dropdownItemFn: (item, int position, bool focused, bool selected,
Function() onTap) =>
ListTile(
title: Text(item['name']),
subtitle: Text(
item['desc'] ?? '',
),
title: Text(item.name),
subtitle: Text(item.description),
tileColor:
focused ? Color.fromARGB(20, 0, 0, 0) : Colors.transparent,
onTap: onTap,
Expand All @@ -110,3 +118,11 @@ class _MyHomePageState extends State<MyHomePage> {
);
}
}

class UserRole {
final String name;
final String description;
final int number;

UserRole(this.name, this.description, this.number);
}
7 changes: 7 additions & 0 deletions example/macos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/

# Xcode-related
**/dgph
**/xcuserdata/
1 change: 1 addition & 0 deletions example/macos/Flutter/Flutter-Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "ephemeral/Flutter-Generated.xcconfig"
1 change: 1 addition & 0 deletions example/macos/Flutter/Flutter-Release.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "ephemeral/Flutter-Generated.xcconfig"
10 changes: 10 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// Generated file. Do not edit.
//

import FlutterMacOS
import Foundation


func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
}
Loading