Skip to content

Commit

Permalink
renamed to flutter_tagging_plus
Browse files Browse the repository at this point in the history
  • Loading branch information
bradintheusa committed Apr 20, 2022
1 parent 4f9f032 commit df4d06f
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 38 deletions.
118 changes: 111 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,120 @@
# Flutter Tagging
# Flutter Tagging Plus

Forked from https://github.com/culjo/flutter_tagging
Forked from https://github.com/culjo/flutter_tagging as it seems abandoned.

Based on https://github.com/sarbagyastha/flutter_tagging/

also grabbed from what is on pub.dev version 3.0.0

This fixes some bugs and has null safety. Also not web specific.

This is just a hack until the original repo is updated.
# Details


A flutter package with tagging or multi-select functionality.
Useful for adding Tag or Label Selection Forms.

![DEMO](flutter_tagging.gif)

```dart
List<Language> _selectedLanguages = [];
FlutterTagging<Language>(
initialItems: _selectedLanguages,
textFieldConfiguration: TextFieldConfiguration(
decoration: InputDecoration(
border: InputBorder.none,
filled: true,
fillColor: Colors.green.withAlpha(30),
hintText: 'Search Tags',
labelText: 'Select Tags',
),
),
findSuggestions: LanguageService.getLanguages,
additionCallback: (value) {
return Language(
name: value,
position: 0,
);
},
onAdded: (language){
// api calls here, triggered when add to tag button is pressed
return Language();
},
configureSuggestion: (lang) {
return SuggestionConfiguration(
title: Text(lang.name),
subtitle: Text(lang.position.toString()),
additionWidget: Chip(
avatar: Icon(
Icons.add_circle,
color: Colors.white,
),
label: Text('Add New Tag'),
labelStyle: TextStyle(
color: Colors.white,
fontSize: 14.0,
fontWeight: FontWeight.w300,
),
backgroundColor: Colors.green,
),
);
},
configureChip: (lang) {
return ChipConfiguration(
label: Text(lang.name),
backgroundColor: Colors.green,
labelStyle: TextStyle(color: Colors.white),
deleteIconColor: Colors.white,
);
},
onChanged: () {
print();
}
);
/// LanguageService
class LanguageService {
/// Mocks fetching language from network API with delay of 500ms.
static Future<List<Language>> getLanguages(String query) async {
await Future.delayed(Duration(milliseconds: 500), null);
return <Language>[
Language(name: 'JavaScript', position: 1),
Language(name: 'Python', position: 2),
Language(name: 'Java', position: 3),
Language(name: 'PHP', position: 4),
Language(name: 'C#', position: 5),
Language(name: 'C++', position: 6),
].where((lang) => lang.name.toLowerCase().contains(query.toLowerCase())).toList();
}
}
```


## License

```
flutter_tagging:
git: https://github.com/bradintheusa/flutter_tagging
Copyright 2020 Sarbagya Dhaubanjar. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
85 changes: 59 additions & 26 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,62 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# STYLE
- camel_case_types
- library_names
- file_names
- library_prefixes
- non_constant_identifier_names
- constant_identifier_names # prefer
- directives_ordering
#- lines_longer_than_80_chars # avoid
- curly_braces_in_flow_control_structures

# DOCUMENTATION
- slash_for_doc_comments
- package_api_docs # prefer # ?
- public_member_api_docs # prefer # ?
#- comment_references # Unused because https://github.com/dart-lang/sdk/issues/36974

# USAGE
- avoid_relative_lib_imports # prefer
- prefer_adjacent_string_concatenation
- prefer_interpolation_to_compose_strings # prefer
- unnecessary_brace_in_string_interps # avoid
- prefer_collection_literals
- avoid_function_literals_in_foreach_calls # avoid
- prefer_iterable_whereType
- prefer_function_declarations_over_variables
- unnecessary_lambdas
- prefer_equal_for_default_values
- avoid_init_to_null
- unnecessary_getters_setters
#- unnecessary_getters # prefer # Disabled pending fix: https://github.com/dart-lang/linter/issues/23
#- prefer_expression_function_bodies # consider
- unnecessary_this
- prefer_initializing_formals
- type_init_formals
- empty_constructor_bodies
- unnecessary_new
- unnecessary_const
- avoid_catches_without_on_clauses # avoid
- use_rethrow_when_possible

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
# DESIGN
- use_to_and_as_if_applicable # prefer
- one_member_abstracts # avoid
- avoid_classes_with_only_static_members # avoid
- prefer_final_fields # prefer
- use_setters_to_change_properties
- avoid_setters_without_getters
- avoid_returning_null # avoid
- avoid_returning_this # avoid
- type_annotate_public_apis # prefer
#- prefer_typing_uninitialized_variables # consider
- omit_local_variable_types # avoid
- avoid_return_types_on_setters
- prefer_generic_function_type_aliases
- avoid_private_typedef_functions # prefer
#- use_function_type_syntax_for_parameters # consider
- avoid_positional_boolean_parameters # avoid
- hash_and_equals
- avoid_null_checks_in_equality_operators
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_syntax_view/flutter_syntax_view.dart';
import 'package:flutter_tagging/flutter_tagging.dart';
import 'package:flutter_tagging_plus/flutter_tagging_plus.dart';

void main() => runApp(MyApp());

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
flutter:
sdk: flutter

flutter_tagging:
flutter_tagging_plus:
path: ../
flutter_syntax_view: ^4.0.0

Expand Down
2 changes: 1 addition & 1 deletion lib/flutter_tagging.dart → lib/flutter_tagging_plus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

library flutter_tagging;
library flutter_tagging_plus;

export 'package:flutter_typeahead/flutter_typeahead.dart';

Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_tagging
name: flutter_tagging_plus
description: A flutter package with tagging or multiselect functionality. Useful for adding Tag or Label Selection Forms.
version: 4.0.0
repository: https://github.com/bradintheusa/flutter_tagging
repository: https://github.com/bradintheusa/flutter_tagging_plus


environment:
Expand Down

0 comments on commit df4d06f

Please sign in to comment.