Skip to content

TF-3603: Integrate Cozy features #3604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: feature/cozy-integration
Choose a base branch
from
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 core/lib/presentation/extensions/color_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ extension AppColor on Color {
static const blue100 = Color(0xFFDFEEFF);
static const blue400 = Color(0xFF80BDFF);
static const m3Tertiary = Color(0xFF8C9CAF);
static const m3Tertiary70 = Color(0xFFE5ECF3);
static const m3Neutral70 = Color(0xFFAEAAAE);
static const grayBackgroundColor = Color(0xFFF3F6F9);
static const m3SurfaceBackground = Color(0xFF1C1B1F);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/views/quick_search/quick_search_action_define.dart';
import 'package:core/presentation/views/quick_search/quick_search_suggestion_box_controller.dart';
import 'package:core/presentation/views/quick_search/quick_search_suggestion_box_decoration.dart';
Expand Down Expand Up @@ -69,6 +70,7 @@ class QuickSearchInputForm<T, P, R> extends FormField<String> {
ItemBuilder<P>? contactItemBuilder,
SuggestionsCallback<P>? contactSuggestionsCallback,
SuggestionSelectionCallback<P>? onContactSuggestionSelected,
Color backgroundColor = AppColor.colorBgDesktop,
}) : assert(
initialValue == null || textFieldConfiguration.controller == null),
assert(minCharsForSuggestions >= 0),
Expand Down Expand Up @@ -138,6 +140,7 @@ class QuickSearchInputForm<T, P, R> extends FormField<String> {
contactItemBuilder: contactItemBuilder,
contactSuggestionsCallback: contactSuggestionsCallback,
onContactSuggestionSelected: onContactSuggestionSelected,
backgroundColor: backgroundColor,
);
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ class TypeAheadFieldQuickSearch<T, P, R> extends StatefulWidget {
/// Min input length to start autocomplete
final int? minInputLengthAutocomplete;

final Color backgroundColor;

/// Creates a [TypeAheadFieldQuickSearch]
const TypeAheadFieldQuickSearch({
Key? key,
Expand Down Expand Up @@ -364,6 +366,7 @@ class TypeAheadFieldQuickSearch<T, P, R> extends StatefulWidget {
this.contactItemBuilder,
this.contactSuggestionsCallback,
this.onContactSuggestionSelected,
this.backgroundColor = AppColor.colorBgDesktop,
}) : assert(animationStart >= 0.0 && animationStart <= 1.0),
assert(
direction == AxisDirection.down || direction == AxisDirection.up),
Expand Down Expand Up @@ -658,9 +661,9 @@ class _TypeAheadFieldQuickSearchState<T, P, R>
],
color: Colors.white,
)
: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12)),
color: AppColor.colorBgDesktop,
: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(12)),
color: widget.backgroundColor,
),
height: widget.maxHeight,
child: Row(
Expand Down
43 changes: 43 additions & 0 deletions cozy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
3 changes: 3 additions & 0 deletions cozy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# cozy

Cozy config for Cozy integration
1 change: 1 addition & 0 deletions cozy/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:flutter_lints/flutter.yaml
1 change: 1 addition & 0 deletions cozy/lib/cozy_config/cozy_config.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'cozy_config_stub.dart' if (dart.library.html) 'cozy_config_web.dart';
25 changes: 25 additions & 0 deletions cozy/lib/cozy_config/cozy_config_stub.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class _CozyConfigManagerStub {
Future<void> injectCozyScript() async {
throw UnimplementedError();
}

Future<void> initialize() async {
throw UnimplementedError();
}
}

class CozyConfig {
static final CozyConfig _instance = CozyConfig._internal();

factory CozyConfig() {
return _instance;
}

CozyConfig._internal();

final manager = _CozyConfigManagerStub();

Future<bool> get isInsideCozy async {
return false;
}
}
21 changes: 21 additions & 0 deletions cozy/lib/cozy_config/cozy_config_web.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'dart:async';

import 'package:linagora_design_flutter/cozy_config_manager/cozy_config_manager.dart';

class CozyConfig {
static final CozyConfig _instance = CozyConfig._internal();

factory CozyConfig() {
return _instance;
}

CozyConfig._internal();

final manager = CozyConfigManager();

bool? _isInsideCozy;

Future<bool> get isInsideCozy async {
return _isInsideCozy ??= await manager.isInsideCozy;
}
}
Loading
Loading