Skip to content
Draft
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
3 changes: 2 additions & 1 deletion .github/workflows/pr_title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- synchronize
branches:
- main
- main-design-system # Remove this once the design system is merged into main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -20,13 +21,13 @@ jobs:
with:
scopes: |
llc
ui
repo
requireScope: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

semantic_changelog_update:
if: ${{ false }} # TODO: Enable after the first release
needs: conventional_pr_title # Trigger after the [conventional_pr_title] completes
runs-on: ubuntu-latest
steps:
Expand Down
45 changes: 36 additions & 9 deletions all_lint_rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ linter:
- always_declare_return_types
- always_put_control_body_on_new_line
- always_put_required_named_parameters_first
- always_require_non_null_named_parameters
- always_specify_types
- always_use_package_imports
- annotate_overrides
- annotate_redeclares
- avoid_annotating_with_dynamic
- avoid_bool_literals_in_conditional_expressions
- avoid_catches_without_on_clauses
Expand All @@ -20,6 +20,7 @@ linter:
- avoid_field_initializers_in_const_classes
- avoid_final_parameters
- avoid_function_literals_in_foreach_calls
- avoid_futureor_void
- avoid_implementing_value_types
- avoid_init_to_null
- avoid_js_rounded_ints
Expand All @@ -32,8 +33,6 @@ linter:
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- avoid_returning_null
- avoid_returning_null_for_future
- avoid_returning_null_for_void
- avoid_returning_this
- avoid_setters_without_getters
Expand Down Expand Up @@ -61,12 +60,15 @@ linter:
- constant_identifier_names
- control_flow_in_finally
- curly_braces_in_flow_control_structures
- dangling_library_doc_comments
- depend_on_referenced_packages
- deprecated_consistency
- deprecated_member_use_from_same_package
- diagnostic_describe_all_properties
- directives_ordering
- discarded_futures
- do_not_use_environment
- document_ignores
- empty_catches
- empty_constructor_bodies
- empty_statements
Expand All @@ -76,32 +78,41 @@ linter:
- flutter_style_todos
- hash_and_equals
- implementation_imports
- iterable_contains_unrelated_type
- implicit_call_tearoffs
- implicit_reopen
- invalid_case_patterns
- invalid_runtime_check_with_js_interop_types
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_annotations
- library_names
- library_prefixes
- library_private_types_in_public_api
- lines_longer_than_80_chars
- list_remove_unrelated_type
- literal_only_boolean_expressions
- matching_super_parameters
- missing_code_block_language_in_doc_comment
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_default_cases
- no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
- no_leading_underscores_for_local_identifiers
- no_literal_bool_comparisons
- no_logic_in_create_state
- no_runtimeType_toString
- no_self_assignments
- no_wildcard_variable_uses
- non_constant_identifier_names
- noop_primitive_operations
- null_check_on_nullable_type_parameter
- null_closures
- omit_local_variable_types
- omit_obvious_local_variable_types
- omit_obvious_property_types
- one_member_abstracts
- only_throw_errors
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
- parameter_assignments
Expand All @@ -117,7 +128,6 @@ linter:
- prefer_constructors_over_static_methods
- prefer_contains
- prefer_double_quotes
- prefer_equal_for_default_values
- prefer_expression_function_bodies
- prefer_final_fields
- prefer_final_in_for_each
Expand Down Expand Up @@ -148,29 +158,42 @@ linter:
- provide_deprecation_message
- public_member_api_docs
- recursive_getters
- remove_deprecations_in_breaking_versions
- require_trailing_commas
- secure_pubspec_urls
- simplify_variable_pattern
- sized_box_for_whitespace
- sized_box_shrink_expand
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
- sort_pub_dependencies
- sort_unnamed_constructors_first
- specify_nonobvious_local_variable_types
- specify_nonobvious_property_types
- strict_top_level_inference
- switch_on_type
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
- type_annotate_public_apis
- type_init_formals
- type_literal_in_constant_pattern
- unawaited_futures
- unintended_html_in_doc_comment
- unnecessary_async
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_breaks
- unnecessary_const
- unnecessary_constructor_name
- unnecessary_final
- unnecessary_getters_setters
- unnecessary_ignore
- unnecessary_lambdas
- unnecessary_late
- unnecessary_library_directive
- unnecessary_library_name
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_aware_operator_on_extension_on_nullable
Expand All @@ -185,9 +208,11 @@ linter:
- unnecessary_string_interpolations
- unnecessary_this
- unnecessary_to_list_in_spreads
- unnecessary_unawaited
- unnecessary_underscores
- unreachable_from_main
- unrelated_type_equality_checks
- unsafe_html
- unsafe_variance
- use_build_context_synchronously
- use_colored_box
- use_decorated_box
Expand All @@ -199,6 +224,7 @@ linter:
- use_key_in_widget_constructors
- use_late_for_private_fields_and_variables
- use_named_constants
- use_null_aware_elements
- use_raw_strings
- use_rethrow_when_possible
- use_setters_to_change_properties
Expand All @@ -207,5 +233,6 @@ linter:
- use_super_parameters
- use_test_throws_matchers
- use_to_and_as_if_applicable
- use_truncating_division
- valid_regexps
- void_checks
- void_checks
19 changes: 17 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ analyzer:
# We explicitly enabled even conflicting rules and are fixing the conflict
# in this file.
included_file_warning: ignore

todo: ignore
exclude:
# exclude all the generated files
- packages/*/lib/**/*.*.dart

formatter:
page_width: 100
trailing_commas: preserve

linter:
rules:
## Disabled rules because the repository doesn't respect them (yet)
Expand Down Expand Up @@ -93,6 +95,19 @@ linter:
# There are situations where we use default in enums on purpose
no_default_cases: false

# Sometimes static methods are more readable
prefer_constructors_over_static_methods: false

# Conflicts with `omit_local_variable_types`
specify_nonobvious_local_variable_types: false
specify_nonobvious_property_types: false

# Makes the code more verbose without adding much value
document_ignores: false

# False positives
unsafe_variance: false

# Temporarily disabled to find more important issues
public_member_api_docs: false
avoid_print: false
45 changes: 45 additions & 0 deletions apps/design_system_gallery/.metadata
Original file line number Diff line number Diff line change
@@ -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 and should not be manually edited.

version:
revision: "05db9689081f091050f01aed79f04dce0c750154"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 05db9689081f091050f01aed79f04dce0c750154
base_revision: 05db9689081f091050f01aed79f04dce0c750154
- platform: android
create_revision: 05db9689081f091050f01aed79f04dce0c750154
base_revision: 05db9689081f091050f01aed79f04dce0c750154
- platform: ios
create_revision: 05db9689081f091050f01aed79f04dce0c750154
base_revision: 05db9689081f091050f01aed79f04dce0c750154
- platform: linux
create_revision: 05db9689081f091050f01aed79f04dce0c750154
base_revision: 05db9689081f091050f01aed79f04dce0c750154
- platform: macos
create_revision: 05db9689081f091050f01aed79f04dce0c750154
base_revision: 05db9689081f091050f01aed79f04dce0c750154
- platform: web
create_revision: 05db9689081f091050f01aed79f04dce0c750154
base_revision: 05db9689081f091050f01aed79f04dce0c750154
- platform: windows
create_revision: 05db9689081f091050f01aed79f04dce0c750154
base_revision: 05db9689081f091050f01aed79f04dce0c750154

# 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'
16 changes: 16 additions & 0 deletions apps/design_system_gallery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# design_system_gallery

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
32 changes: 32 additions & 0 deletions apps/design_system_gallery/lib/components/button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
import 'package:stream_core_flutter/stream_core_flutter.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

// Import the widget from your app

@widgetbook.UseCase(name: 'Default', type: StreamButton)
Widget buildCoolButtonUseCase(BuildContext context) {
return Center(
child: StreamButton(
label: context.knobs.string(label: 'Label', initialValue: 'Click me'),
onTap: () {
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('Button clicked')));
},
type: context.knobs.object.dropdown(
label: 'Type',
options: StreamButtonType.values,
initialOption: StreamButtonType.primary,
labelBuilder: (option) => option.name,
),
size: context.knobs.object.dropdown(
label: 'Size',
options: StreamButtonSize.values,
initialOption: StreamButtonSize.large,
labelBuilder: (option) => option.name,
),
),
);
}
38 changes: 38 additions & 0 deletions apps/design_system_gallery/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

// This file does not exist yet,
// it will be generated in the next step
import 'main.directories.g.dart';
import 'theme_config.dart';

void main() {
runApp(const WidgetbookApp());
}

@widgetbook.App()
class WidgetbookApp extends StatelessWidget {
const WidgetbookApp({super.key});

@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (context) => ThemeConfiguration.empty(),
child: Widgetbook.material(
themeMode: ThemeMode.light,
// The [directories] variable does not exist yet,
// it will be generated in the next step
directories: directories,

appBuilder: (context, child) => MaterialApp(
theme: ThemeData.light().copyWith(
extensions: [context.watch<ThemeConfiguration>().themeData],
),
home: Scaffold(body: child),
),
),
);
}
}
Loading