Skip to content

Commit

Permalink
Add support for the auto complete widget
Browse files Browse the repository at this point in the history
  • Loading branch information
divyanshub024 committed Mar 20, 2024
1 parent 47dcfd3 commit aeccce5
Show file tree
Hide file tree
Showing 12 changed files with 476 additions and 1 deletion.
29 changes: 29 additions & 0 deletions examples/mirai_gallery/assets/json/auto_complete_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"type": "scaffold",
"appBar": {
"type": "appBar",
"title": {
"type": "text",
"data": "Autocomplete Basic"
}
},
"body": {
"type": "center",
"child": {
"type": "column",
"children": [
{
"type": "text",
"data": "Type below to autocomplete the following possible results: [aardvark, bobcat, chameleon]."
},
{
"type": "autocomplete",
"options": [
"aardvark", "bobcat", "chameleon"
],
"onSelected": {}
}
]
}
}
}
31 changes: 31 additions & 0 deletions examples/mirai_gallery/assets/json/home_screen.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,37 @@
}
}
},
{
"type": "listTile",
"leading": {
"type": "icon",
"iconType": "material",
"icon": "done_all"
},
"title": {
"type": "text",
"data": "Mirai AutoComplete",
"style": {
"fontSize": 21
}
},
"subtitle": {
"type": "text",
"data": "Create a auto complete widget with list of strings",
"style": {
"fontSize": 12
}
},
"isThreeLine": true,
"onTap": {
"actionType": "navigate",
"navigationStyle": "push",
"widgetJson": {
"type": "exampleScreen",
"assetPath": "assets/json/auto_complete_example.json"
}
}
},
{
"type": "listTile",
"leading": {
Expand Down
14 changes: 14 additions & 0 deletions examples/mirai_gallery/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
PODS:
- Flutter (1.0.0)
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
- webview_flutter_wkwebview (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

EXTERNAL SOURCES:
Flutter:
:path: Flutter
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
sqflite:
:path: ".symlinks/plugins/sqflite/darwin"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36

PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
Expand Down
16 changes: 15 additions & 1 deletion examples/mirai_gallery/macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
PODS:
- FlutterMacOS (1.0.0)
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.3):
- Flutter
- FlutterMacOS

DEPENDENCIES:
- FlutterMacOS (from `Flutter/ephemeral`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`)

EXTERNAL SOURCES:
FlutterMacOS:
:path: Flutter/ephemeral
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
sqflite:
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin

SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

COCOAPODS: 1.14.3
COCOAPODS: 1.15.2
18 changes: 18 additions & 0 deletions examples/mirai_gallery/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
33CC10EB2044A3C60003C045 /* Resources */,
33CC110E2044A8840003C045 /* Bundle Framework */,
3399D490228B24CF009A79C7 /* ShellScript */,
7866210B3EA7701BEC7B9DC8 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -381,6 +382,23 @@
shellPath = /bin/sh;
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
};
7866210B3EA7701BEC7B9DC8 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
FC682B1371BF9CD8324FEA17 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
2 changes: 2 additions & 0 deletions packages/mirai/lib/src/framework/mirai.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter/services.dart';
import 'package:mirai/src/action_parsers/action_parsers.dart';
import 'package:mirai/src/action_parsers/mirai_network_request/mirai_network_request_parser.dart';
import 'package:mirai/src/framework/mirai_registry.dart';
import 'package:mirai/src/parsers/mirai_auto_complete/mirai_auto_complete_parser.dart';
import 'package:mirai/src/parsers/parsers.dart';
import 'package:mirai/src/services/mirai_network_service.dart';
import 'package:mirai/src/utils/log.dart';
Expand Down Expand Up @@ -69,6 +70,7 @@ class Mirai {
const MiraiBottomNavigationViewParser(),
const MiraiDefaultBottomNavigationControllerParser(),
const MiraiWrapParser(),
const MiraiAutoCompleteParser(),
];

static final _actionParsers = <MiraiActionParser>[
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

export 'mirai_auto_complete_parser.dart';

part 'mirai_auto_complete.freezed.dart';
part 'mirai_auto_complete.g.dart';

@freezed
class MiraiAutoComplete with _$MiraiAutoComplete {
const factory MiraiAutoComplete({
required List<String> options,
Map<String, dynamic>? onSelected,
@Default(200) double optionsMaxHeight,
// optionsViewBuilder,
@Default(OptionsViewOpenDirection.down)
OptionsViewOpenDirection optionsViewOpenDirection,
String? initialValue,
}) = _MiraiAutoComplete;

factory MiraiAutoComplete.fromJson(Map<String, dynamic> json) =>
_$MiraiAutoCompleteFromJson(json);
}
Loading

0 comments on commit aeccce5

Please sign in to comment.