Skip to content

Commit

Permalink
Assorted changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pante committed May 21, 2024
1 parent c2f561e commit 2b9d644
Show file tree
Hide file tree
Showing 106 changed files with 161 additions and 94 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
name: Samples Build
name: Forui Example Build

on:
workflow_dispatch: {}
push:
paths:
- .github/workflows/samples_build.yaml
- .github/workflows/forui_example_build.yaml
- forui/**
- samples/**

jobs:
build-android:
name: Build Android
runs-on: ubuntu-latest
defaults:
run:
working-directory: samples
working-directory: forui/example
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Samples Presubmit
name: Forui Example Presubmit

on:
workflow_dispatch: {}
pull_request:
branches: [ master ]
paths:
- .github/workflows/samples_presubmit.yaml
- samples/**
- .github/workflows/forui_example_presubmit.yaml
- forui/example/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: samples
working-directory: forui/example

steps:
- uses: tibdex/github-app-token@v2
Expand Down
23 changes: 22 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class Foo extends StatelessWidget {
}
```

### Mark widgets as final when sensible

Subclasses can interact with Forui in unforeseen ways, and cause potential issues. It is not breaking to initially mark
classes as `final`, and subsequently unmark it. The inverse isn't true. Favor composition over inheritance.

### Minimize dependency on 3rd party packages

3rd party packages introduce uncertainty. It is difficult to predict whether a package will be maintained in the future.
Expand All @@ -53,6 +58,22 @@ In some situations, it is unrealistic to implement things ourselves. In these ca

Lastly, types from 3rd party packages should not be publicly exported by Forui.


## Conventions

* Prefix all publicly exported widgets with `F`, i.e. `FScaffold`.
* Prefix all publicly exported widgets and styles with `F`, i.e. `FScaffold`.

## Widget Styles

Widget styles, i.e. `CardStyle`, should mix-in [Diagnosticable](https://api.flutter.dev/flutter/foundation/Diagnosticable-mixin.html).
It should override the [debugFillProperties](https://api.flutter.dev/flutter/foundation/Diagnosticable/debugFillProperties.html)
method to include all fields in the style.

Widget styles, i.e. `CardStyle`, should provide:
* a primary constructor
* a named constructor, `inherit(...)` , that configures itself based on an ancestor `FTheme`.

Widget styles, i.e. `CardStyle`, should override the hashCode and equality operator (==).

Do not scale `TextStyles` inside a widget style during its initialization. Instead, scale the `TextStyle`s inside a
widget's build method. This avoids confusion on whether `TextStyle`s are automatically scaled inside widget styles.
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--------------------------------------------------------------------------------
Forui

MIT License

Copyright (c) 2024 Forus Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion forui/LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--------------------------------------------------------------------------------
forui
Forui

MIT License

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion samples/lib/main.dart → forui/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Application extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
home: FTheme(
data: FThemes.light,
data: FThemes.zinc.light,
child: Scaffold(
backgroundColor: Colors.white,
body: Padding(
Expand Down
75 changes: 37 additions & 38 deletions samples/pubspec.lock → forui/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ packages:
dependency: transitive
description:
name: args
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
url: "https://pub.dev"
source: hosted
version: "2.4.2"
version: "2.5.0"
async:
dependency: transitive
description:
Expand Down Expand Up @@ -61,10 +61,10 @@ packages:
dependency: transitive
description:
name: build_daemon
sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1"
sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9"
url: "https://pub.dev"
source: hosted
version: "4.0.1"
version: "4.0.2"
build_resolvers:
dependency: transitive
description:
Expand All @@ -77,10 +77,10 @@ packages:
dependency: "direct dev"
description:
name: build_runner
sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21"
sha256: "1414d6d733a85d8ad2f1dfcb3ea7945759e35a123cb99ccfac75d0758f75edfa"
url: "https://pub.dev"
source: hosted
version: "2.4.8"
version: "2.4.10"
build_runner_core:
dependency: transitive
description:
Expand All @@ -101,10 +101,10 @@ packages:
dependency: transitive
description:
name: built_value
sha256: fedde275e0a6b798c3296963c5cd224e3e1b55d0e478d5b7e65e6b540f363a0e
sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb
url: "https://pub.dev"
source: hosted
version: "8.9.1"
version: "8.9.2"
characters:
dependency: transitive
description:
Expand Down Expand Up @@ -222,18 +222,18 @@ packages:
forui:
dependency: "direct main"
description:
path: "../forui"
path: ".."
relative: true
source: path
version: "0.0.1"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612"
sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694
url: "https://pub.dev"
source: hosted
version: "3.2.0"
version: "4.0.0"
glob:
dependency: transitive
description:
Expand All @@ -246,10 +246,10 @@ packages:
dependency: transitive
description:
name: google_fonts
sha256: "5b1726fee554d1cc9db1baef8061b126567ff0a1140a03ed7de936e62f2ab98b"
sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82
url: "https://pub.dev"
source: hosted
version: "6.2.0"
version: "6.2.1"
graphs:
dependency: transitive
description:
Expand Down Expand Up @@ -302,10 +302,10 @@ packages:
dependency: transitive
description:
name: json_annotation
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
url: "https://pub.dev"
source: hosted
version: "4.8.1"
version: "4.9.0"
leak_tracker:
dependency: transitive
description:
Expand Down Expand Up @@ -398,26 +398,26 @@ packages:
dependency: transitive
description:
name: path_provider
sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b
sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161
url: "https://pub.dev"
source: hosted
version: "2.1.2"
version: "2.1.3"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668"
sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d
url: "https://pub.dev"
source: hosted
version: "2.2.2"
version: "2.2.4"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f"
sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16
url: "https://pub.dev"
source: hosted
version: "2.3.2"
version: "2.4.0"
path_provider_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -494,10 +494,10 @@ packages:
dependency: transitive
description:
name: shelf_web_socket
sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611"
url: "https://pub.dev"
source: hosted
version: "1.0.4"
version: "2.0.0"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -527,15 +527,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.11.1"
stevia_runner:
dependency: "direct dev"
description:
path: stevia_runner
ref: HEAD
resolved-ref: f8e5e00e12f23fc0fc659b48a71d033e0aaf4bfe
url: "https://github.com/forus-labs/cauldron.git"
source: git
version: "1.0.0"
stream_channel:
dependency: transitive
description:
Expand Down Expand Up @@ -632,22 +623,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.5.1"
web_socket:
dependency: transitive
description:
name: web_socket
sha256: "217f49b5213796cb508d6a942a5dc604ce1cb6a0a6b3d8cb3f0c314f0ecea712"
url: "https://pub.dev"
source: hosted
version: "0.1.4"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
sha256: "1d8e795e2a8b3730c41b8a98a2dff2e0fb57ae6f0764a1c46ec5915387d257b2"
sha256: a2d56211ee4d35d9b344d9d4ce60f362e4f5d1aafb988302906bd732bc731276
url: "https://pub.dev"
source: hosted
version: "2.4.4"
version: "3.0.0"
win32:
dependency: transitive
description:
name: win32
sha256: "8cb58b45c47dcb42ab3651533626161d6b67a2921917d8d429791f76972b3480"
sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4
url: "https://pub.dev"
source: hosted
version: "5.3.0"
version: "5.5.1"
xdg_directories:
dependency: transitive
description:
Expand All @@ -665,5 +664,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.19.0"
dart: ">=3.4.0 <4.0.0"
flutter: ">=3.19.2"
7 changes: 1 addition & 6 deletions samples/pubspec.yaml → forui/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ environment:
dependencies:
flutter:
sdk: flutter
# TODO: replace with published version
forui:
path: ../forui
path: ../
sugar: ^3.1.0

dev_dependencies:
Expand All @@ -36,10 +35,6 @@ dev_dependencies:
flutter_test:
sdk: flutter
mockito: ^5.4.2
stevia_runner:
git:
url: https://github.com/forus-labs/cauldron.git
path: stevia_runner

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions forui/lib/forui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ library forui;

// Theme
export 'src/theme/color_scheme.dart';
export 'src/theme/style.dart';
export 'src/theme/theme.dart';
export 'src/theme/theme_data.dart';

Expand Down
Loading

0 comments on commit 2b9d644

Please sign in to comment.