├── example ├── linux │ ├── .gitignore │ ├── main.cc │ ├── flutter │ │ ├── generated_plugin_registrant.h │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugins.cmake │ │ └── CMakeLists.txt │ └── my_application.h ├── ios │ ├── Runner │ │ ├── Runner-Bridging-Header.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── .gitignore │ └── Podfile ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── manifest.json │ └── index.html ├── android │ ├── gradle.properties │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── values-night │ │ │ │ │ │ └── styles.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── .gitignore │ ├── settings.gradle │ └── build.gradle ├── macos │ ├── Runner │ │ ├── Configs │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ ├── Warnings.xcconfig │ │ │ └── AppInfo.xcconfig │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── app_icon_16.png │ │ │ │ ├── app_icon_32.png │ │ │ │ ├── app_icon_64.png │ │ │ │ ├── app_icon_1024.png │ │ │ │ ├── app_icon_128.png │ │ │ │ ├── app_icon_256.png │ │ │ │ ├── app_icon_512.png │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── Release.entitlements │ │ ├── DebugProfile.entitlements │ │ ├── MainFlutterWindow.swift │ │ └── Info.plist │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Podfile.lock │ └── Podfile ├── windows │ ├── runner │ │ ├── resources │ │ │ └── app_icon.ico │ │ ├── resource.h │ │ ├── utils.h │ │ ├── runner.exe.manifest │ │ ├── flutter_window.h │ │ ├── main.cpp │ │ ├── CMakeLists.txt │ │ ├── utils.cpp │ │ ├── flutter_window.cpp │ │ └── Runner.rc │ ├── .gitignore │ └── flutter │ │ ├── generated_plugin_registrant.h │ │ ├── generated_plugin_registrant.cc │ │ └── generated_plugins.cmake ├── README.md ├── .gitignore ├── analysis_options.yaml └── .metadata ├── CHANGELOG.md ├── lib ├── src │ ├── components │ │ ├── alerts │ │ │ ├── alert_type.dart │ │ │ ├── alert_close_button.dart │ │ │ ├── alert_icon.dart │ │ │ ├── base_alert.dart │ │ │ ├── small_alert.dart │ │ │ └── alert.dart │ │ ├── badges │ │ │ ├── badge_type.dart │ │ │ └── badge.dart │ │ ├── banners │ │ │ ├── banner_link.dart │ │ │ ├── banner_text.dart │ │ │ └── banner.dart │ │ ├── accordion │ │ │ ├── accordion_data.dart │ │ │ ├── accordion_border.dart │ │ │ ├── accordion_panel.dart │ │ │ └── accordion.dart │ │ ├── buttons │ │ │ ├── base_radio.dart │ │ │ ├── base_button.dart │ │ │ ├── radio.dart │ │ │ ├── secondary.dart │ │ │ ├── primary.dart │ │ │ └── tertiary.dart │ │ ├── shared │ │ │ └── close_button.dart │ │ └── radio_group │ │ │ ├── radio_group_form_field.dart │ │ │ └── radio_group.dart │ ├── fonts.dart │ ├── utils │ │ └── named_property.dart │ ├── theme │ │ ├── breakpoints.dart │ │ ├── theme_widget.dart │ │ ├── button_style.dart │ │ ├── radius.dart │ │ ├── icons.dart │ │ └── theme_data.dart │ ├── gen │ │ ├── lang │ │ │ └── fr.dart │ │ └── default_localizations.dart │ └── localization │ │ ├── all_languages.dart │ │ └── l10n.dart ├── icons │ └── remixicon.ttf ├── fonts │ ├── Marianne │ │ ├── Marianne-Bold.otf │ │ ├── Marianne-Thin.otf │ │ ├── Marianne-Light.otf │ │ ├── Marianne-Medium.otf │ │ ├── Marianne-ExtraBold.otf │ │ ├── Marianne-Regular.otf │ │ ├── Marianne-BoldItalic.otf │ │ ├── Marianne-LightItalic.otf │ │ ├── Marianne-ThinItalic.otf │ │ ├── Marianne-MediumItalic.otf │ │ ├── Marianne-RegularItalic.otf │ │ └── Marianne-ExtraBoldItalic.otf │ └── Spectral │ │ ├── Spectral-Bold.ttf │ │ ├── Spectral-Italic.ttf │ │ ├── Spectral-Light.ttf │ │ ├── Spectral-Medium.ttf │ │ ├── Spectral-ExtraBold.ttf │ │ ├── Spectral-Regular.ttf │ │ ├── Spectral-SemiBold.ttf │ │ ├── Spectral-BoldItalic.ttf │ │ ├── Spectral-ExtraLight.ttf │ │ ├── Spectral-LightItalic.ttf │ │ ├── Spectral-MediumItalic.ttf │ │ ├── Spectral-SemiBoldItalic.ttf │ │ ├── Spectral-ExtraBoldItalic.ttf │ │ └── Spectral-ExtraLightItalic.ttf ├── flutter_dsfr_localizations.dart ├── l10n │ └── flutter_dsfr_fr.arb └── flutter_dsfr.dart ├── dart_test.yaml ├── screenshots ├── alert.png ├── badge.png ├── radio.png ├── banner.png ├── accordion.png ├── radio_group.png ├── small_alert.png ├── buttons_group.png ├── france_connect.png ├── primary_button.png ├── secondary_button.png └── france_connect_plus.png ├── test ├── theme │ ├── goldens │ │ └── ci │ │ │ ├── icons.png │ │ │ ├── sizes.png │ │ │ ├── radius.png │ │ │ ├── typography.png │ │ │ ├── colors_dark.png │ │ │ └── colors_light.png │ ├── icons_test.dart │ ├── typography_test.dart │ ├── sizes_test.dart │ ├── radius_test.dart │ └── colors_test.dart ├── components │ ├── logo │ │ ├── goldens │ │ │ └── ci │ │ │ │ └── logo.png │ │ └── logo_test.dart │ ├── alerts │ │ ├── goldens │ │ │ └── ci │ │ │ │ ├── alert_dark.png │ │ │ │ ├── alert_light.png │ │ │ │ ├── small_alert_dark.png │ │ │ │ ├── small_alert_light.png │ │ │ │ └── primary_button_dark.png │ │ └── small_alert_test.dart │ ├── badges │ │ └── goldens │ │ │ └── ci │ │ │ ├── badge_dark.png │ │ │ └── badge_light.png │ ├── accordion │ │ ├── goldens │ │ │ └── ci │ │ │ │ ├── accordion_dark.png │ │ │ │ └── accordion_light.png │ │ ├── accordion_robot.dart │ │ └── accordion_test.dart │ ├── banners │ │ └── goldens │ │ │ └── ci │ │ │ ├── banner_large_dark.png │ │ │ ├── banner_small_dark.png │ │ │ ├── banner_large_light.png │ │ │ └── banner_small_light.png │ ├── buttons │ │ ├── goldens │ │ │ └── ci │ │ │ │ ├── radio_button_dark.png │ │ │ │ ├── radio_group_light.png │ │ │ │ ├── radio_rich_light.png │ │ │ │ ├── primary_button_dark.png │ │ │ │ ├── radio_button_light.png │ │ │ │ ├── france_connect_button.png │ │ │ │ ├── primary_button_light.png │ │ │ │ ├── secondary_button_dark.png │ │ │ │ ├── secondary_button_light.png │ │ │ │ ├── tertiary_button_dark.png │ │ │ │ ├── tertiary_button_light.png │ │ │ │ └── france_connect_button_dark.png │ │ ├── radio_rich_test.dart │ │ ├── france_connect_button_test.dart │ │ ├── primary_button_test.dart │ │ └── secondary_button_test.dart │ └── buttons_group │ │ └── goldens │ │ └── ci │ │ ├── buttons_group_vertical.png │ │ └── buttons_group_horizontal.png ├── flutter_test_config.dart └── utils │ └── font.dart ├── analysis_options.yaml ├── .vscode └── launch.json ├── .metadata ├── .github └── workflows │ ├── contribute.yml │ ├── build.yml │ └── tests.yml ├── docs ├── flutter-dsfr-roadmap.md └── flutter-dsfr-localizations.md ├── .gitignore ├── LICENSE ├── bin └── add_label.dart └── pubspec.yaml /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 2 | 3 | * TODO: Describe initial release. 4 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/src/components/alerts/alert_type.dart: -------------------------------------------------------------------------------- 1 | enum DSFRAlertType { error, success, info, warning } 2 | -------------------------------------------------------------------------------- /dart_test.yaml: -------------------------------------------------------------------------------- 1 | tags: 2 | golden: 3 | atom: 4 | molecule: 5 | organism: 6 | light: 7 | dark: 8 | -------------------------------------------------------------------------------- /lib/src/components/badges/badge_type.dart: -------------------------------------------------------------------------------- 1 | enum DSFRBadgeType { error, success, info, warning, news } 2 | -------------------------------------------------------------------------------- /screenshots/alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/screenshots/alert.png -------------------------------------------------------------------------------- /screenshots/badge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/screenshots/badge.png -------------------------------------------------------------------------------- /screenshots/radio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/screenshots/radio.png -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/web/favicon.png -------------------------------------------------------------------------------- /lib/icons/remixicon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/icons/remixicon.ttf -------------------------------------------------------------------------------- /screenshots/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/screenshots/banner.png -------------------------------------------------------------------------------- /screenshots/accordion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/screenshots/accordion.png -------------------------------------------------------------------------------- /screenshots/radio_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/screenshots/radio_group.png -------------------------------------------------------------------------------- /screenshots/small_alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/screenshots/small_alert.png -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /screenshots/buttons_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/screenshots/buttons_group.png -------------------------------------------------------------------------------- /screenshots/france_connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/screenshots/france_connect.png -------------------------------------------------------------------------------- /screenshots/primary_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/screenshots/primary_button.png -------------------------------------------------------------------------------- /test/theme/goldens/ci/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/theme/goldens/ci/icons.png -------------------------------------------------------------------------------- /test/theme/goldens/ci/sizes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/theme/goldens/ci/sizes.png -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /screenshots/secondary_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/screenshots/secondary_button.png -------------------------------------------------------------------------------- /test/theme/goldens/ci/radius.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/theme/goldens/ci/radius.png -------------------------------------------------------------------------------- /lib/fonts/Marianne/Marianne-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Marianne/Marianne-Bold.otf -------------------------------------------------------------------------------- /lib/fonts/Marianne/Marianne-Thin.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Marianne/Marianne-Thin.otf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-Bold.ttf -------------------------------------------------------------------------------- /screenshots/france_connect_plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/screenshots/france_connect_plus.png -------------------------------------------------------------------------------- /test/theme/goldens/ci/typography.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/theme/goldens/ci/typography.png -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /lib/fonts/Marianne/Marianne-Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Marianne/Marianne-Light.otf -------------------------------------------------------------------------------- /lib/fonts/Marianne/Marianne-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Marianne/Marianne-Medium.otf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-Italic.ttf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-Light.ttf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-Medium.ttf -------------------------------------------------------------------------------- /test/theme/goldens/ci/colors_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/theme/goldens/ci/colors_dark.png -------------------------------------------------------------------------------- /test/theme/goldens/ci/colors_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/theme/goldens/ci/colors_light.png -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:fd_lints/flutter.yaml 2 | 3 | analyzer: 4 | exclude: 5 | - "lib/src/components/logo/logo.dart" 6 | -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /lib/fonts/Marianne/Marianne-ExtraBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Marianne/Marianne-ExtraBold.otf -------------------------------------------------------------------------------- /lib/fonts/Marianne/Marianne-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Marianne/Marianne-Regular.otf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-ExtraBold.ttf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-Regular.ttf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-SemiBold.ttf -------------------------------------------------------------------------------- /test/components/logo/goldens/ci/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/logo/goldens/ci/logo.png -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /lib/fonts/Marianne/Marianne-BoldItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Marianne/Marianne-BoldItalic.otf -------------------------------------------------------------------------------- /lib/fonts/Marianne/Marianne-LightItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Marianne/Marianne-LightItalic.otf -------------------------------------------------------------------------------- /lib/fonts/Marianne/Marianne-ThinItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Marianne/Marianne-ThinItalic.otf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-BoldItalic.ttf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-ExtraLight.ttf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-LightItalic.ttf -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /lib/fonts/Marianne/Marianne-MediumItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Marianne/Marianne-MediumItalic.otf -------------------------------------------------------------------------------- /lib/fonts/Marianne/Marianne-RegularItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Marianne/Marianne-RegularItalic.otf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-MediumItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-MediumItalic.ttf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-SemiBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-SemiBoldItalic.ttf -------------------------------------------------------------------------------- /lib/fonts/Marianne/Marianne-ExtraBoldItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Marianne/Marianne-ExtraBoldItalic.otf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-ExtraBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-ExtraBoldItalic.ttf -------------------------------------------------------------------------------- /lib/fonts/Spectral/Spectral-ExtraLightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/lib/fonts/Spectral/Spectral-ExtraLightItalic.ttf -------------------------------------------------------------------------------- /lib/src/fonts.dart: -------------------------------------------------------------------------------- 1 | class DSFRFonts { 2 | const DSFRFonts._(); 3 | 4 | static const marianne = 'Marianne'; 5 | static const spectral = 'Spectral'; 6 | } 7 | -------------------------------------------------------------------------------- /test/components/alerts/goldens/ci/alert_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/alerts/goldens/ci/alert_dark.png -------------------------------------------------------------------------------- /test/components/badges/goldens/ci/badge_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/badges/goldens/ci/badge_dark.png -------------------------------------------------------------------------------- /test/components/alerts/goldens/ci/alert_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/alerts/goldens/ci/alert_light.png -------------------------------------------------------------------------------- /test/components/badges/goldens/ci/badge_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/badges/goldens/ci/badge_light.png -------------------------------------------------------------------------------- /lib/flutter_dsfr_localizations.dart: -------------------------------------------------------------------------------- 1 | library flutter_dsfr_localizations; 2 | 3 | export 'src/gen/default_localizations.dart'; 4 | export 'src/localization/l10n.dart'; 5 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /test/components/accordion/goldens/ci/accordion_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/accordion/goldens/ci/accordion_dark.png -------------------------------------------------------------------------------- /test/components/accordion/goldens/ci/accordion_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/accordion/goldens/ci/accordion_light.png -------------------------------------------------------------------------------- /test/components/alerts/goldens/ci/small_alert_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/alerts/goldens/ci/small_alert_dark.png -------------------------------------------------------------------------------- /test/components/alerts/goldens/ci/small_alert_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/alerts/goldens/ci/small_alert_light.png -------------------------------------------------------------------------------- /test/components/banners/goldens/ci/banner_large_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/banners/goldens/ci/banner_large_dark.png -------------------------------------------------------------------------------- /test/components/banners/goldens/ci/banner_small_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/banners/goldens/ci/banner_small_dark.png -------------------------------------------------------------------------------- /test/components/buttons/goldens/ci/radio_button_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons/goldens/ci/radio_button_dark.png -------------------------------------------------------------------------------- /test/components/buttons/goldens/ci/radio_group_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons/goldens/ci/radio_group_light.png -------------------------------------------------------------------------------- /test/components/buttons/goldens/ci/radio_rich_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons/goldens/ci/radio_rich_light.png -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /test/components/alerts/goldens/ci/primary_button_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/alerts/goldens/ci/primary_button_dark.png -------------------------------------------------------------------------------- /test/components/banners/goldens/ci/banner_large_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/banners/goldens/ci/banner_large_light.png -------------------------------------------------------------------------------- /test/components/banners/goldens/ci/banner_small_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/banners/goldens/ci/banner_small_light.png -------------------------------------------------------------------------------- /test/components/buttons/goldens/ci/primary_button_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons/goldens/ci/primary_button_dark.png -------------------------------------------------------------------------------- /test/components/buttons/goldens/ci/radio_button_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons/goldens/ci/radio_button_light.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /test/components/buttons/goldens/ci/france_connect_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons/goldens/ci/france_connect_button.png -------------------------------------------------------------------------------- /test/components/buttons/goldens/ci/primary_button_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons/goldens/ci/primary_button_light.png -------------------------------------------------------------------------------- /test/components/buttons/goldens/ci/secondary_button_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons/goldens/ci/secondary_button_dark.png -------------------------------------------------------------------------------- /test/components/buttons/goldens/ci/secondary_button_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons/goldens/ci/secondary_button_light.png -------------------------------------------------------------------------------- /test/components/buttons/goldens/ci/tertiary_button_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons/goldens/ci/tertiary_button_dark.png -------------------------------------------------------------------------------- /test/components/buttons/goldens/ci/tertiary_button_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons/goldens/ci/tertiary_button_light.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /test/components/buttons/goldens/ci/france_connect_button_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons/goldens/ci/france_connect_button_dark.png -------------------------------------------------------------------------------- /test/components/buttons_group/goldens/ci/buttons_group_vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons_group/goldens/ci/buttons_group_vertical.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /test/components/buttons_group/goldens/ci/buttons_group_horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/test/components/buttons_group/goldens/ci/buttons_group_horizontal.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Floating-Dartists/flutter_dsfr/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/src/utils/named_property.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | @immutable 4 | class NamedProperty { 5 | const NamedProperty(this.name, this.property); 6 | 7 | final String name; 8 | final T property; 9 | } 10 | -------------------------------------------------------------------------------- /lib/l10n/flutter_dsfr_fr.arb: -------------------------------------------------------------------------------- 1 | { 2 | "@@locale": "fr", 3 | "auth": "S'identifier avec", 4 | "france_connect": "FranceConnect", 5 | "what_is_france_connect": "Qu'est-ce que FranceConnect ?", 6 | "what_is_france_connect_plus": "Qu'est-ce que FranceConnect+ ?" 7 | } -------------------------------------------------------------------------------- /lib/src/components/banners/banner_link.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | @immutable 4 | class DSFRBannerLink { 5 | const DSFRBannerLink({required this.text, required this.onTap}); 6 | 7 | final String text; 8 | final VoidCallback onTap; 9 | } 10 | -------------------------------------------------------------------------------- /example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 7 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "example - flutter_dsfr", 6 | "request": "launch", 7 | "type": "dart", 8 | "flutterMode": "debug", 9 | "program": "example/lib/main.dart" 10 | }, 11 | ] 12 | } -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: cd41fdd495f6944ecd3506c21e94c6567b073278 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | UrlLauncherWindowsRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 14 | } 15 | -------------------------------------------------------------------------------- /example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/src/theme/breakpoints.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// Breakpoints value for different screen sizes. 4 | /// 5 | /// Anything above [Breakpoints.lg] (>= 1248.0) will be considered as being 6 | /// "xl". 7 | @immutable 8 | class Breakpoints { 9 | const Breakpoints._(); 10 | 11 | static const xs = 575.0; 12 | static const sm = 767.0; 13 | static const md = 991.0; 14 | static const lg = 1247.0; 15 | } 16 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import shared_preferences_macos 9 | import url_launcher_macos 10 | 11 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 12 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 13 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 14 | } 15 | -------------------------------------------------------------------------------- /example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void fl_register_plugins(FlPluginRegistry* registry) { 12 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 13 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 14 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 15 | } 16 | -------------------------------------------------------------------------------- /test/components/logo/logo_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:alchemist/alchemist.dart'; 2 | import 'package:flutter_dsfr/src/components/logo/logo.dart'; 3 | 4 | void main() { 5 | goldenTest( 6 | 'logo rendering', 7 | fileName: 'logo', 8 | builder: () => GoldenTestGroup( 9 | children: [ 10 | GoldenTestScenario(name: 'default', child: const DSFRLogo()), 11 | GoldenTestScenario( 12 | name: 'size: 48', 13 | child: const DSFRLogo(size: 48), 14 | ), 15 | ], 16 | ), 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.github/workflows/contribute.yml: -------------------------------------------------------------------------------- 1 | name: Contribute List 2 | 3 | on: 4 | workflow_run: 5 | workflows: [Build example] 6 | branches: main 7 | types: [completed] 8 | 9 | jobs: 10 | contrib-readme-job: 11 | if: ${{ github.event.workflow_run.conclusion == 'success' }} 12 | runs-on: ubuntu-latest 13 | name: A job to automate contrib in readme 14 | steps: 15 | - name: Contribute List 16 | uses: akhilmhdh/contributors-readme-action@v2.3.6 17 | env: 18 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 19 | -------------------------------------------------------------------------------- /lib/src/components/accordion/accordion_data.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | @immutable 4 | class DSFRAccordionData { 5 | const DSFRAccordionData({ 6 | required this.title, 7 | required this.content, 8 | this.isInitialyExpanded = false, 9 | }); 10 | final String title; 11 | final Widget content; 12 | 13 | /// expand the panel by default. 14 | /// 15 | /// In case where there is multiple panels who are expanded by default, 16 | /// only the last one will be expanded because DSFRAccordion have a radio like 17 | /// logic 18 | final bool isInitialyExpanded; 19 | } 20 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build example 2 | 3 | on: 4 | workflow_run: 5 | workflows: [Test workflow] 6 | branches: main 7 | types: [completed] 8 | 9 | jobs: 10 | build: 11 | if: ${{ github.event.workflow_run.conclusion == 'success' }} 12 | name: Build example 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: subosito/flutter-action@v2 17 | with: 18 | channel: "stable" 19 | - uses: bluefireteam/flutter-gh-pages@v8 20 | with: 21 | workingDir: example 22 | webRenderer: canvaskit 23 | baseHref: /flutter_dsfr/ 24 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /lib/src/gen/lang/fr.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: non_constant_identifier_names, always_use_package_imports 4 | 5 | import '../default_localizations.dart'; 6 | 7 | class FrLocalizations extends DSFRLocalizationLabels { 8 | const FrLocalizations(); 9 | 10 | @override 11 | String get auth => "S'identifier avec"; 12 | 13 | @override 14 | String get france_connect => "FranceConnect"; 15 | 16 | @override 17 | String get what_is_france_connect => "Qu'est-ce que FranceConnect ?"; 18 | 19 | @override 20 | String get what_is_france_connect_plus => "Qu'est-ce que FranceConnect+ ?"; 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/components/buttons/base_radio.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | abstract class DSFRBaseRadio extends StatelessWidget { 4 | const DSFRBaseRadio({ 5 | super.key, 6 | required this.label, 7 | required this.value, 8 | required this.groupValue, 9 | required this.onChanged, 10 | this.description, 11 | this.hasError = false, 12 | }); 13 | 14 | final String label; 15 | final String? description; 16 | final T value; 17 | final T? groupValue; 18 | final ValueChanged? onChanged; 19 | final bool hasError; 20 | 21 | bool get isSelected => groupValue == value; 22 | bool get disabled => onChanged == null; 23 | } 24 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /lib/src/components/alerts/alert_close_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | import 'package:flutter_dsfr/src/components/shared/close_button.dart'; 4 | 5 | class AlertCloseButton extends StatelessWidget { 6 | const AlertCloseButton({required this.onClose, super.key}); 7 | 8 | final void Function() onClose; 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | final dsfrTheme = DSFRThemeData.of(context); 13 | 14 | return Padding( 15 | padding: EdgeInsets.all(dsfrTheme.sizes.v1), 16 | child: Align( 17 | alignment: Alignment.topCenter, 18 | child: SharedCloseButton(onClose: onClose), 19 | ), 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/theme/icons_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:alchemist/alchemist.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 4 | 5 | import '../flutter_test_config.dart'; 6 | 7 | void main() { 8 | goldenTest( 9 | 'icons rendering', 10 | fileName: 'icons', 11 | tags: ['golden', 'atom'], 12 | // ignore: avoid_redundant_argument_values 13 | skip: isRunningInCi, 14 | builder: () => GoldenTestGroup( 15 | children: DSFRIcons.props 16 | .map( 17 | (e) => GoldenTestScenario( 18 | name: e.name, 19 | child: Icon(e.property), 20 | ), 21 | ) 22 | .toList(), 23 | ), 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Test workflow 2 | 3 | on: 4 | push: 5 | branches: [main, dev] 6 | pull_request: 7 | branches: [main, dev] 8 | 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - uses: subosito/flutter-action@v2 15 | with: 16 | channel: "stable" 17 | - name: Fetch dependencies 18 | run: flutter packages get 19 | - name: Analyze project 20 | run: flutter analyze --no-fatal-infos 21 | - name: Run tests 22 | run: flutter test --coverage --dart-define=CI=true 23 | - name: Collect and report coverage 24 | uses: coverallsapp/github-action@v1.1.2 25 | with: 26 | github-token: ${{ secrets.GITHUB_TOKEN }} 27 | -------------------------------------------------------------------------------- /lib/src/localization/all_languages.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:flutter_dsfr/src/gen/default_localizations.dart'; 3 | import 'package:flutter_dsfr/src/gen/lang/fr.dart'; 4 | 5 | final kSupportedLanguages = { 6 | 'fr', 7 | }; 8 | 9 | DSFRLocalizationLabels getDSFRTranslation( 10 | Locale useLocale, [ 11 | Locale? defaultLocale, 12 | ]) { 13 | final Locale locale; 14 | if (kSupportedLanguages.contains(useLocale.languageCode)) { 15 | locale = useLocale; 16 | } else { 17 | locale = defaultLocale ?? useLocale; 18 | } 19 | 20 | switch (locale.languageCode) { 21 | case 'fr': 22 | return const FrLocalizations(); 23 | } 24 | 25 | throw Exception( 26 | 'getDSFRTranslation() called for unsupported locale "$locale"', 27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /test/theme/typography_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:alchemist/alchemist.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 4 | 5 | import '../flutter_test_config.dart'; 6 | 7 | void main() { 8 | goldenTest( 9 | 'DSFRTypography.regular', 10 | fileName: 'typography', 11 | // ignore: avoid_redundant_argument_values 12 | skip: isRunningInCi, // Test not needed in CI 13 | builder: () => GoldenTestGroup( 14 | children: const DSFRTypography.medium() 15 | .props 16 | .map( 17 | (e) => GoldenTestScenario( 18 | name: e.name, 19 | child: Text('Hello world!', style: e.property), 20 | ), 21 | ) 22 | .toList(), 23 | ), 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /docs/flutter-dsfr-roadmap.md: -------------------------------------------------------------------------------- 1 | # Flutter DSFR Roadmap 2 | 3 | Components we need to implement 4 | 5 | - [X] Accordion 6 | - [ ] FileUpload 7 | - [X] Alerts 8 | - [X] Badges 9 | - [X] Banner 10 | - [ ] SearchBar 11 | - [X] Buttons 12 | - [X] ButtonsGroup 13 | - [X] FranceConnectButton 14 | - [X] Radio 15 | - [ ] RichRadio 16 | - [ ] Checkbox 17 | - [ ] Card 18 | - [ ] Input 19 | - [ ] Quote 20 | - [ ] Header 21 | - [ ] Breadcrumb 22 | - [ ] ConscentBanner 23 | - [ ] StepIndicateur 24 | - [ ] ToggleSwitch 25 | - [ ] Links 26 | - [ ] SkipLinks 27 | - [ ] Select 28 | - [ ] SideMenu 29 | - [ ] Callout 30 | - [ ] Highlight 31 | - [ ] Modal 32 | - [ ] MainNavigation 33 | - [ ] Tabs 34 | - [ ] Display 35 | - [ ] Share 36 | - [ ] Footer 37 | - [ ] Pagination 38 | - [ ] Summary 39 | - [ ] Table 40 | - [ ] Tag 41 | - [ ] DownloadFile 42 | - [ ] Tile -------------------------------------------------------------------------------- /test/theme/sizes_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:alchemist/alchemist.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 4 | 5 | import '../flutter_test_config.dart'; 6 | 7 | void main() { 8 | goldenTest( 9 | 'DSFRSizes.regular', 10 | // ignore: avoid_redundant_argument_values 11 | skip: isRunningInCi, 12 | fileName: 'sizes', 13 | builder: () => GoldenTestGroup( 14 | children: const DSFRSizes.regular() 15 | .props 16 | .map( 17 | (e) => GoldenTestScenario( 18 | name: e.name, 19 | child: Container( 20 | color: Colors.white, 21 | height: 50, 22 | width: e.property, 23 | ), 24 | ), 25 | ) 26 | .toList(), 27 | ), 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | .flutter-plugins 32 | 33 | # Ignore non-CI golden files and failures 34 | test/**/goldens/**/*.* 35 | test/**/failures/**/*.* 36 | !test/**/goldens/ci/*.* 37 | .flutter-plugins-dependencies 38 | 39 | coverage/ 40 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_linux 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_windows 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/src/theme/theme_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | 4 | /// {@template dsfr_theme_widget} 5 | /// A widget that overrides the theme with the provided [theme] for its [child]. 6 | /// {@endtemplate} 7 | class DSFRThemeWidget extends StatelessWidget { 8 | /// {@macro dsfr_theme_widget} 9 | const DSFRThemeWidget({ 10 | super.key, 11 | required this.data, 12 | required this.child, 13 | }); 14 | 15 | final DSFRThemeData data; 16 | final Widget child; 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | final theme = Theme.of(context); 21 | final themeExtensions = Map.from(theme.extensions); 22 | 23 | themeExtensions[DSFRThemeData] = data; 24 | 25 | return Theme( 26 | data: theme.copyWith(extensions: themeExtensions.values), 27 | child: child, 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/components/accordion/accordion_border.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | 4 | class DSFRAccordionBorder extends StatelessWidget { 5 | const DSFRAccordionBorder({ 6 | required this.child, 7 | required this.isLastInGroup, 8 | super.key, 9 | }); 10 | 11 | final bool isLastInGroup; 12 | final Widget child; 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | final dsfrTheme = DSFRThemeData.of(context); 17 | final dsfrColors = dsfrTheme.colors; 18 | final border = BorderSide(color: dsfrColors.accordionBorder); 19 | final bottomBorder = isLastInGroup ? border : BorderSide.none; 20 | 21 | return DecoratedBox( 22 | decoration: BoxDecoration( 23 | border: Border( 24 | top: border, 25 | bottom: bottomBorder, 26 | ), 27 | ), 28 | child: child, 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/theme/radius_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:alchemist/alchemist.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 4 | import 'package:flutter_dsfr/src/theme/palette.dart'; 5 | 6 | void main() { 7 | goldenTest( 8 | 'DSFRRadius.regular', 9 | fileName: 'radius', 10 | builder: () => GoldenTestGroup( 11 | children: const DSFRRadius.regular() 12 | .props 13 | .map( 14 | (e) => GoldenTestScenario( 15 | name: e.name, 16 | child: Container( 17 | width: 50, 18 | height: 50, 19 | decoration: BoxDecoration( 20 | borderRadius: BorderRadius.only(topLeft: e.property), 21 | color: ColorPalette.blueFranceMain525, 22 | ), 23 | ), 24 | ), 25 | ) 26 | .toList(), 27 | ), 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Web related 36 | lib/generated_plugin_registrant.dart 37 | 38 | # Symbolication related 39 | app.*.symbols 40 | 41 | # Obfuscation related 42 | app.*.map.json 43 | 44 | # Android Studio will place build artifacts here 45 | /android/app/debug 46 | /android/app/profile 47 | /android/app/release 48 | -------------------------------------------------------------------------------- /lib/src/components/alerts/alert_icon.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | 4 | class AlertIcon extends StatelessWidget { 5 | const AlertIcon({ 6 | required this.color, 7 | required this.icon, 8 | required this.padding, 9 | this.shouldCenterIcon = false, 10 | super.key, 11 | }); 12 | 13 | final Color color; 14 | final IconData icon; 15 | final EdgeInsets padding; 16 | final bool shouldCenterIcon; 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | final dsfrTheme = DSFRThemeData.of(context); 21 | final aligment = shouldCenterIcon ? Alignment.center : Alignment.topCenter; 22 | 23 | return Container( 24 | color: color, 25 | padding: padding, 26 | child: Align( 27 | alignment: aligment, 28 | child: Icon( 29 | icon, 30 | color: dsfrTheme.colors.alertsBackground, 31 | ), 32 | ), 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/flutter_test_config.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: avoid_redundant_argument_values 2 | 3 | import 'dart:async'; 4 | 5 | import 'package:alchemist/alchemist.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 8 | 9 | import 'utils/font.dart'; 10 | 11 | const isRunningInCi = bool.fromEnvironment('CI', defaultValue: false); 12 | 13 | Future testExecutable(FutureOr Function() testMain) async { 14 | await loadTestFonts(); 15 | 16 | return AlchemistConfig.runWithConfig( 17 | config: AlchemistConfig( 18 | ciGoldensConfig: const CiGoldensConfig(tolerance: 0.01), 19 | theme: ThemeData( 20 | fontFamily: DSFRFonts.marianne, 21 | brightness: Brightness.light, 22 | useMaterial3: false, 23 | extensions: const [ 24 | DSFRThemeData(colors: DSFRColors.light()), 25 | ], 26 | ), 27 | platformGoldensConfig: const PlatformGoldensConfig( 28 | enabled: !isRunningInCi, 29 | ), 30 | ), 31 | run: testMain, 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /example/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FlutterMacOS (1.0.0) 3 | - shared_preferences_macos (0.0.1): 4 | - FlutterMacOS 5 | - url_launcher_macos (0.0.1): 6 | - FlutterMacOS 7 | 8 | DEPENDENCIES: 9 | - FlutterMacOS (from `Flutter/ephemeral`) 10 | - shared_preferences_macos (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`) 11 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) 12 | 13 | EXTERNAL SOURCES: 14 | FlutterMacOS: 15 | :path: Flutter/ephemeral 16 | shared_preferences_macos: 17 | :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos 18 | url_launcher_macos: 19 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos 20 | 21 | SPEC CHECKSUMS: 22 | FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 23 | shared_preferences_macos: a64dc611287ed6cbe28fd1297898db1336975727 24 | url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3 25 | 26 | PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c 27 | 28 | COCOAPODS: 1.11.2 29 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Guillaume Roux 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /lib/src/components/alerts/base_alert.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/src/components/alerts/alert_type.dart'; 3 | import 'package:flutter_dsfr/src/theme/colors.dart'; 4 | import 'package:flutter_dsfr/src/theme/icons.dart'; 5 | 6 | abstract class BaseAlert extends StatelessWidget { 7 | const BaseAlert({required this.type, this.onClose, super.key}); 8 | final DSFRAlertType type; 9 | final void Function()? onClose; 10 | 11 | @protected 12 | Color getColor(DSFRColors dsfrColors) { 13 | switch (type) { 14 | case DSFRAlertType.error: 15 | return dsfrColors.error; 16 | case DSFRAlertType.success: 17 | return dsfrColors.success; 18 | case DSFRAlertType.info: 19 | return dsfrColors.info; 20 | case DSFRAlertType.warning: 21 | return dsfrColors.warning; 22 | } 23 | } 24 | 25 | @protected 26 | IconData getIconData() { 27 | switch (type) { 28 | case DSFRAlertType.error: 29 | return DSFRIcons.errorWarningFill; 30 | case DSFRAlertType.success: 31 | return DSFRIcons.checkboxCircleFill; 32 | case DSFRAlertType.info: 33 | return DSFRIcons.info; 34 | case DSFRAlertType.warning: 35 | return DSFRIcons.alertFill; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /test/theme/colors_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:alchemist/alchemist.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 4 | 5 | void main() { 6 | goldenTest( 7 | 'DSFRColors.light', 8 | fileName: 'colors_light', 9 | tags: ['golden', 'light'], 10 | builder: () => GoldenTestGroup( 11 | children: const DSFRColors.light() 12 | .props 13 | .map( 14 | (e) => GoldenTestScenario( 15 | name: e.name, 16 | child: Container( 17 | height: 50, 18 | width: 50, 19 | color: e.property, 20 | ), 21 | ), 22 | ) 23 | .toList(), 24 | ), 25 | ); 26 | 27 | goldenTest( 28 | 'DSFRColors.dark', 29 | fileName: 'colors_dark', 30 | tags: ['golden', 'dark'], 31 | builder: () => GoldenTestGroup( 32 | children: const DSFRColors.dark() 33 | .props 34 | .map( 35 | (e) => GoldenTestScenario( 36 | name: e.name, 37 | child: Container( 38 | height: 50, 39 | width: 50, 40 | color: e.property, 41 | ), 42 | ), 43 | ) 44 | .toList(), 45 | ), 46 | ); 47 | } 48 | -------------------------------------------------------------------------------- /example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.11' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/src/gen/default_localizations.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: non_constant_identifier_names, always_use_package_imports 4 | 5 | import 'package:flutter/material.dart'; 6 | 7 | import 'lang/fr.dart'; 8 | 9 | /// An abstract class containing all labels that concrete languages should 10 | /// provide. 11 | /// 12 | /// The easiest way to override some of these labels is to provide 13 | /// an object that extends [DefaultLocalizations] and pass it to the 14 | /// [MaterialApp.localizationsDelegates]. 15 | /// 16 | /// ```dart 17 | /// import 'package:flutter_dsfr/flutter_dsfr.dart'; 18 | /// 19 | /// class LabelOverrides extends DefaultLocalizations { 20 | /// const LabelOverrides(); 21 | /// 22 | /// @override 23 | /// String get auth => 'Authenticate with'; 24 | /// } 25 | /// 26 | /// MaterialApp( 27 | /// // ... 28 | /// localizationsDelegates: [ 29 | /// DSFRLocalizations.withDefaultOverrides(const LabelOverrides()), 30 | /// GlobalMaterialLocalizations.delegate, 31 | /// GlobalWidgetsLocalizations.delegate, 32 | /// DSFRLocalizations.delegate, 33 | /// ], 34 | /// ) 35 | /// ``` 36 | abstract class DSFRLocalizationLabels { 37 | const DSFRLocalizationLabels(); 38 | 39 | String get auth; 40 | 41 | String get france_connect; 42 | 43 | String get what_is_france_connect; 44 | 45 | String get what_is_france_connect_plus; 46 | } 47 | 48 | class DefaultLocalizations extends FrLocalizations { 49 | const DefaultLocalizations(); 50 | } 51 | -------------------------------------------------------------------------------- /lib/flutter_dsfr.dart: -------------------------------------------------------------------------------- 1 | library flutter_dsfr; 2 | 3 | export 'src/components/accordion/accordion.dart'; 4 | export 'src/components/accordion/accordion_data.dart'; 5 | export 'src/components/alerts/alert.dart'; 6 | export 'src/components/alerts/alert_type.dart'; 7 | export 'src/components/alerts/small_alert.dart'; 8 | export 'src/components/badges/badge.dart'; 9 | export 'src/components/badges/badge_type.dart'; 10 | export 'src/components/banners/banner.dart'; 11 | export 'src/components/banners/banner_link.dart'; 12 | export 'src/components/buttons/base_button.dart' 13 | hide DSFRBaseButton, DSFRGroupeableButton; 14 | export 'src/components/buttons/france_connect.dart' 15 | hide FranceConnectBase, InfoLinkButton; 16 | export 'src/components/buttons/primary.dart'; 17 | export 'src/components/buttons/radio.dart'; 18 | export 'src/components/buttons/radio_rich.dart'; 19 | export 'src/components/buttons/secondary.dart'; 20 | export 'src/components/buttons/tertiary.dart'; 21 | export 'src/components/buttons_group/buttons_group.dart'; 22 | export 'src/components/radio_group/radio_group.dart'; 23 | export 'src/components/radio_group/radio_group_form_field.dart'; 24 | export 'src/dsfr_app.dart'; 25 | export 'src/fonts.dart'; 26 | export 'src/theme/button_style.dart'; 27 | export 'src/theme/colors.dart'; 28 | export 'src/theme/icons.dart'; 29 | export 'src/theme/radius.dart'; 30 | export 'src/theme/sizes.dart'; 31 | export 'src/theme/spacings.dart'; 32 | export 'src/theme/theme_data.dart'; 33 | export 'src/theme/theme_widget.dart'; 34 | export 'src/theme/typography.dart'; 35 | -------------------------------------------------------------------------------- /test/components/buttons/radio_rich_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:alchemist/alchemist.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 4 | 5 | void main() { 6 | const image = SizedBox( 7 | width: 80, 8 | height: 80, 9 | child: ColoredBox( 10 | color: Color(0xFF0063CB), 11 | ), 12 | ); 13 | 14 | goldenTest( 15 | 'light rich radio button widget rendering', 16 | fileName: 'radio_rich_light', 17 | tags: ['golden', 'light', 'atom'], 18 | builder: () => GoldenTestGroup( 19 | columns: 1, 20 | children: [ 21 | GoldenTestScenario( 22 | name: 'unselected', 23 | child: DSFRRadioRich( 24 | label: 'Label radio', 25 | value: true, 26 | groupValue: false, 27 | onChanged: (_) {}, 28 | image: image, 29 | ), 30 | ), 31 | GoldenTestScenario( 32 | name: 'selected', 33 | child: DSFRRadioRich( 34 | label: 'Label radio', 35 | value: true, 36 | groupValue: true, 37 | onChanged: (_) {}, 38 | image: image, 39 | ), 40 | ), 41 | GoldenTestScenario( 42 | name: 'disabled', 43 | child: const DSFRRadioRich( 44 | label: 'Label radio', 45 | value: true, 46 | groupValue: false, 47 | onChanged: null, 48 | image: image, 49 | ), 50 | ), 51 | ], 52 | ), 53 | ); 54 | } 55 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /lib/src/components/shared/close_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | 4 | /// {@template dsfr_fr_connect_button} 5 | /// A close button used in mutliple component 6 | /// 7 | /// this is an internal component and shouldn't be exposed 8 | /// {@endtemplate} 9 | class SharedCloseButton extends StatelessWidget { 10 | /// {@macro dsfr_fr_connect_button} 11 | const SharedCloseButton({required this.onClose, super.key}); 12 | 13 | final VoidCallback onClose; 14 | 15 | static const _elevation = 0.0; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | final dsfrTheme = DSFRThemeData.of(context); 20 | final dsfrSizes = dsfrTheme.sizes; 21 | final dsfrColors = dsfrTheme.colors; 22 | 23 | return SizedBox( 24 | width: dsfrSizes.w3, 25 | height: dsfrSizes.w3, 26 | child: RawMaterialButton( 27 | elevation: _elevation, 28 | fillColor: Colors.transparent, 29 | constraints: const BoxConstraints(), 30 | shape: const CircleBorder(), 31 | hoverColor: dsfrColors.hover, 32 | highlightColor: dsfrColors.active, 33 | hoverElevation: _elevation, 34 | focusElevation: _elevation, 35 | highlightElevation: _elevation, 36 | focusColor: dsfrColors.hover, 37 | splashColor: dsfrColors.splash, 38 | onPressed: onClose, 39 | child: Icon( 40 | DSFRIcons.closeFill, 41 | color: dsfrColors.alertsCloseButtonIcon, 42 | size: dsfrSizes.w2, 43 | ), 44 | ), 45 | ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/src/components/banners/banner_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/gestures.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 4 | 5 | /// DSFRBannerText, it add a clickable link when the link attribute is not empty 6 | class DSFRBannerText extends StatelessWidget { 7 | const DSFRBannerText({ 8 | required this.text, 9 | required this.link, 10 | super.key, 11 | }); 12 | 13 | final String text; 14 | final DSFRBannerLink? link; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | final dsfrTheme = DSFRThemeData.of(context); 19 | final dsfrColors = dsfrTheme.colors; 20 | final dsfrTypography = dsfrTheme.typography; 21 | 22 | final textColor = dsfrColors.info; 23 | final textStyle = dsfrTypography.boldText.copyWith(color: textColor); 24 | // we assign to a new variable for type shadowing 25 | final bannerLink = link; 26 | 27 | return Text.rich( 28 | TextSpan( 29 | children: [ 30 | TextSpan( 31 | text: text, 32 | style: textStyle, 33 | ), 34 | if (bannerLink != null) ...[ 35 | TextSpan( 36 | text: ',\x20', 37 | style: textStyle, 38 | ), 39 | TextSpan( 40 | text: bannerLink.text, 41 | recognizer: TapGestureRecognizer()..onTap = link?.onTap, 42 | style: textStyle.copyWith( 43 | decoration: TextDecoration.underline, 44 | ), 45 | ), 46 | ], 47 | ], 48 | ), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /test/components/buttons/france_connect_button_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:alchemist/alchemist.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 4 | import 'package:flutter_test/flutter_test.dart'; 5 | 6 | void main() { 7 | group('FranceConnectButton', () { 8 | final widget = GoldenTestGroup( 9 | children: [ 10 | GoldenTestScenario( 11 | name: 'default', 12 | child: FranceConnectButton( 13 | onPressed: () {}, 14 | onInfoLinkTap: () {}, 15 | ), 16 | ), 17 | GoldenTestScenario( 18 | name: 'variant', 19 | child: FranceConnectButton.plus( 20 | onPressed: () {}, 21 | onInfoLinkTap: () {}, 22 | ), 23 | ), 24 | GoldenTestScenario( 25 | name: 'rounded', 26 | child: FranceConnectButton( 27 | onPressed: () {}, 28 | onInfoLinkTap: () {}, 29 | style: DSFRButtonStyle( 30 | shape: RoundedRectangleBorder( 31 | borderRadius: BorderRadius.circular(12), 32 | ), 33 | ), 34 | ), 35 | ), 36 | ], 37 | ); 38 | 39 | goldenTest( 40 | 'renders light mode', 41 | fileName: 'france_connect_button', 42 | builder: () => widget, 43 | ); 44 | 45 | goldenTest( 46 | 'renders dark mode', 47 | fileName: 'france_connect_button_dark', 48 | builder: () => DSFRThemeWidget( 49 | data: const DSFRThemeData( 50 | colors: DSFRColors.dark(), 51 | ), 52 | child: widget, 53 | ), 54 | ); 55 | }); 56 | } 57 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/utils/font.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_dsfr/src/fonts.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | /// This loads fonts for the test runner. 6 | Future loadTestFonts() async { 7 | TestWidgetsFlutterBinding.ensureInitialized(); 8 | 9 | await _loadFamily( 10 | 'flutter_dsfr', 11 | DSFRFonts.marianne, 12 | [ 13 | 'fonts/Marianne/Marianne-Thin.otf', 14 | 'fonts/Marianne/Marianne-ThinItalic.otf', 15 | 'fonts/Marianne/Marianne-Light.otf', 16 | 'fonts/Marianne/Marianne-LightItalic.otf', 17 | 'fonts/Marianne/Marianne-Regular.otf', 18 | 'fonts/Marianne/Marianne-RegularItalic.otf', 19 | 'fonts/Marianne/Marianne-Medium.otf', 20 | 'fonts/Marianne/Marianne-MediumItalic.otf', 21 | 'fonts/Marianne/Marianne-Bold.otf', 22 | 'fonts/Marianne/Marianne-BoldItalic.otf', 23 | 'fonts/Marianne/Marianne-ExtraBold.otf', 24 | 'fonts/Marianne/Marianne-ExtraBoldItalic.otf', 25 | ], 26 | ); 27 | await _loadFamily( 28 | 'flutter_dsfr', 29 | DSFRFonts.spectral, 30 | [ 31 | 'fonts/Spectral/Spectral-Light.ttf', 32 | 'fonts/Spectral/Spectral-LightItalic.ttf', 33 | 'fonts/Spectral/Spectral-Regular.ttf', 34 | 'fonts/Spectral/Spectral-Italic.ttf', 35 | ], 36 | ); 37 | await _loadFamily('flutter_dsfr', 'Remix Icon', ['icons/remixicon.ttf']); 38 | } 39 | 40 | Future _loadFamily( 41 | String package, 42 | String name, 43 | List assets, 44 | ) async { 45 | final prefix = 'packages/$package/'; 46 | final fontLoader = FontLoader('$prefix$name'); 47 | 48 | for (final asset in assets) { 49 | final bytes = rootBundle.load('$prefix$asset'); 50 | fontLoader.addFont(bytes); 51 | } 52 | await fontLoader.load(); 53 | } 54 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/flutter-dsfr-localizations.md: -------------------------------------------------------------------------------- 1 | # Flutter DSFR Localizations 2 | 3 | ## Usage 4 | 5 | If your app supports only a single language, and you want to override labels – you will need to provide a custom class that implements `DefaultLocalizations`, for example: 6 | 7 | ```dart 8 | import 'package:flutter_localizations/flutter_localizations.dart'; 9 | import 'package:flutter_dsfr/flutter_dsfr_localizations.dart'; 10 | 11 | class LabelOverrides extends DefaultLocalizations { 12 | const LabelOverrides(); 13 | 14 | @override 15 | String get auth => 'S\'authentifier'; 16 | } 17 | ``` 18 | 19 | Once created, pass the instance of `LabelOverrides` to the `localizationsDelegates` list in your `MaterialApp`/`CupertinoApp`/`DSFRApp`: 20 | 21 | ```dart 22 | class MyApp extends StatelessWidget { 23 | const MyApp({Key? key}) : super(key: key); 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return DSFRApp( 28 | localizationsDelegates: [ 29 | // Creates an instance of DSFRLocalizationDelegate with overridden labels 30 | DSFRLocalizations.withDefaultOverrides(const LabelOverrides()), 31 | 32 | // Delegates below take care of built-in flutter widgets 33 | GlobalMaterialLocalizations.delegate, 34 | GlobalWidgetsLocalizations.delegate, 35 | 36 | // This delegate is required to provide the labels that are not overridden by LabelOverrides 37 | DSFRLocalizations.delegate, 38 | ], 39 | // ... 40 | ); 41 | } 42 | } 43 | ``` 44 | 45 | If you need to support multiple languages – follow the [official Flutter localization guide](https://docs.flutter.dev/development/accessibility-and-localization/internationalization#an-alternative-class-for-the-apps-localized-resources) 46 | and make sure that your custom delegate extends `LocalizationsDelegate`. -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: cd41fdd495f6944ecd3506c21e94c6567b073278 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 17 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 18 | - platform: android 19 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 20 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 21 | - platform: ios 22 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 23 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 24 | - platform: linux 25 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 26 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 27 | - platform: macos 28 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 29 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 30 | - platform: web 31 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 32 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 33 | - platform: windows 34 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 35 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 37 | 38 | # Run the Flutter tool portions of the build. This must not be removed. 39 | add_dependencies(${BINARY_NAME} flutter_assemble) 40 | -------------------------------------------------------------------------------- /test/components/accordion/accordion_robot.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | import 'package:flutter_dsfr/src/components/accordion/accordion_panel.dart'; 4 | import 'package:flutter_test/flutter_test.dart'; 5 | 6 | class AccordionRobot { 7 | const AccordionRobot({required this.tester}); 8 | 9 | final WidgetTester tester; 10 | 11 | Future renderAccordion({ 12 | required List panels, 13 | }) async { 14 | await tester.pumpWidget( 15 | MaterialApp( 16 | theme: ThemeData( 17 | useMaterial3: false, 18 | fontFamily: DSFRFonts.marianne, 19 | brightness: Brightness.light, 20 | extensions: const [ 21 | DSFRThemeData(colors: DSFRColors.light()), 22 | ], 23 | ), 24 | home: SingleChildScrollView( 25 | child: DSFRAccordion(panels: panels), 26 | ), 27 | ), 28 | ); 29 | } 30 | 31 | void expenctNAccordionPanelWidget(int n) { 32 | final accordion = find.byType(DSFRAccordionPanel); 33 | expect(accordion, findsNWidgets(n)); 34 | } 35 | 36 | Future tapOnFirstAccordionPanelWidget() async { 37 | final accordionPanels = find.byType(DSFRAccordionPanel); 38 | await tester.tap(accordionPanels.first); 39 | await tester.pumpAndSettle(); 40 | } 41 | 42 | Future tapOnLastAccordionPanelWidget() async { 43 | final accordionPanels = find.byType(DSFRAccordionPanel); 44 | await tester.tap(accordionPanels.last); 45 | await tester.pumpAndSettle(); 46 | } 47 | 48 | void expectContentByText(String contentText) { 49 | final content = find.text(contentText); 50 | expect(content, findsOneWidget); 51 | } 52 | 53 | void expectNoContentByText(String contentText) { 54 | final content = find.text(contentText); 55 | expect(content, findsNothing); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /bin/add_label.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:io'; 3 | 4 | import 'package:path/path.dart' as path; 5 | 6 | Future main(List args) async { 7 | final name = prompt('Label name'); 8 | final cwd = Directory.current.path; 9 | final l10nSrc = Directory(path.join(cwd, 'lib', 'l10n')); 10 | 11 | final frArb = File(path.join(l10nSrc.path, 'flutter_dsfr_fr.arb')); 12 | final frContent = 13 | jsonDecode(await frArb.readAsString()) as Map; 14 | 15 | if (frContent.containsKey(name)) { 16 | stderr.writeln('Label "$name" already exists'); 17 | exit(1); 18 | } 19 | 20 | final description = prompt('Label description'); 21 | final frTranslation = prompt('French translation'); 22 | 23 | final files = l10nSrc.listSync().whereType().toList(); 24 | final futures = files.map((file) async { 25 | final newContent = await addLabel(file, name, description, frTranslation); 26 | final b = StringBuffer(); 27 | final string = const JsonEncoder.withIndent(' ').convert(newContent); 28 | b 29 | ..write(string) 30 | ..writeln(); 31 | 32 | await file.writeAsString(b.toString()); 33 | }); 34 | 35 | await Future.wait(futures); 36 | stdout.writeln('Done!'); 37 | } 38 | 39 | String prompt(String tag) { 40 | stdout.write('$tag?: '); 41 | final answer = stdin.readLineSync(); 42 | if (answer == null || answer.isEmpty) { 43 | throw Exception('$tag is required'); 44 | } 45 | return answer; 46 | } 47 | 48 | Future> addLabel( 49 | File file, 50 | String name, 51 | String description, 52 | String frTranslation, 53 | ) async { 54 | final content = jsonDecode(await file.readAsString()) as Map; 55 | 56 | return { 57 | ...content, 58 | "@@last_modified": DateTime.now().toIso8601String(), 59 | name: frTranslation, 60 | "@$name": {"description": description}, 61 | }; 62 | } 63 | -------------------------------------------------------------------------------- /lib/src/components/alerts/small_alert.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | import 'package:flutter_dsfr/src/components/alerts/alert_close_button.dart'; 4 | import 'package:flutter_dsfr/src/components/alerts/alert_icon.dart'; 5 | import 'package:flutter_dsfr/src/components/alerts/base_alert.dart'; 6 | 7 | class DSFRSmallAlert extends BaseAlert { 8 | const DSFRSmallAlert({ 9 | required super.type, 10 | required this.description, 11 | super.onClose, 12 | super.key, 13 | }); 14 | 15 | final String description; 16 | 17 | EdgeInsets _getIconPadding(DSFRSizes sizes) { 18 | return EdgeInsets.all(sizes.w1); 19 | } 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | final dsfrTheme = DSFRThemeData.of(context); 24 | final dsfrColors = dsfrTheme.colors; 25 | final dsfrSizes = dsfrTheme.sizes; 26 | final color = getColor(dsfrColors); 27 | 28 | return DecoratedBox( 29 | decoration: BoxDecoration( 30 | color: dsfrColors.alertsBackground, 31 | border: Border.all(color: color), 32 | ), 33 | child: IntrinsicHeight( 34 | child: Row( 35 | children: [ 36 | AlertIcon( 37 | color: color, 38 | icon: getIconData(), 39 | padding: _getIconPadding(dsfrSizes), 40 | shouldCenterIcon: true, 41 | ), 42 | Expanded( 43 | child: Padding( 44 | padding: EdgeInsets.all(dsfrSizes.w1), 45 | child: Text( 46 | description, 47 | style: DefaultTextStyle.of(context) 48 | .style 49 | .copyWith(color: dsfrColors.text), 50 | ), 51 | ), 52 | ), 53 | if (onClose != null) AlertCloseButton(onClose: onClose!), 54 | ], 55 | ), 56 | ), 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /lib/src/theme/button_style.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | @immutable 6 | class DSFRButtonStyle extends ThemeExtension { 7 | const DSFRButtonStyle({ 8 | this.shape, 9 | this.elevation, 10 | this.mainAxisSize = MainAxisSize.min, 11 | }); 12 | 13 | /// Provide some default values for the button style. 14 | const DSFRButtonStyle.regular() 15 | : this( 16 | shape: const RoundedRectangleBorder(), 17 | elevation: 0, 18 | mainAxisSize: MainAxisSize.min, 19 | ); 20 | 21 | final double? elevation; 22 | 23 | /// The shape of the button. 24 | final ShapeBorder? shape; 25 | 26 | final MainAxisSize mainAxisSize; 27 | 28 | @override 29 | DSFRButtonStyle copyWith({ 30 | ShapeBorder? shape, 31 | double? elevation, 32 | MainAxisSize? mainAxisSize, 33 | }) { 34 | return DSFRButtonStyle( 35 | shape: shape ?? this.shape, 36 | elevation: elevation ?? this.elevation, 37 | mainAxisSize: mainAxisSize ?? this.mainAxisSize, 38 | ); 39 | } 40 | 41 | @override 42 | DSFRButtonStyle lerp(ThemeExtension? other, double t) { 43 | if (other is! DSFRButtonStyle) { 44 | return this; 45 | } 46 | return copyWith( 47 | shape: ShapeBorder.lerp(shape, other.shape, t), 48 | elevation: lerpDouble(elevation, other.elevation, t), 49 | mainAxisSize: other.mainAxisSize, 50 | ); 51 | } 52 | 53 | @override 54 | bool operator ==(Object other) { 55 | return identical(this, other) || 56 | other is DSFRButtonStyle && 57 | runtimeType == other.runtimeType && 58 | shape == other.shape && 59 | elevation == other.elevation && 60 | mainAxisSize == other.mainAxisSize; 61 | } 62 | 63 | @override 64 | int get hashCode { 65 | return Object.hash( 66 | runtimeType, 67 | shape, 68 | elevation, 69 | mainAxisSize, 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /lib/src/theme/radius.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/src/utils/named_property.dart'; 3 | 4 | @immutable 5 | class DSFRRadius extends ThemeExtension { 6 | const DSFRRadius._({required this.small}); 7 | 8 | const DSFRRadius.regular() : this._(small: const Radius.circular(4)); 9 | 10 | final Radius small; 11 | 12 | @override 13 | DSFRRadius copyWith() { 14 | return DSFRRadius._(small: small); 15 | } 16 | 17 | @override 18 | DSFRRadius lerp(ThemeExtension? other, double t) { 19 | if (other is! DSFRRadius) return this; 20 | return DSFRRadius._(small: Radius.lerp(small, other.small, t)!); 21 | } 22 | 23 | @override 24 | bool operator ==(Object other) { 25 | return identical(this, other) || 26 | other is DSFRRadius && 27 | runtimeType == other.runtimeType && 28 | small == other.small; 29 | } 30 | 31 | @override 32 | int get hashCode => Object.hash(runtimeType, small); 33 | 34 | @visibleForTesting 35 | List> get props => [ 36 | NamedProperty('small', small), 37 | ]; 38 | } 39 | 40 | @immutable 41 | class DSFRBorderRadius extends ThemeExtension { 42 | const DSFRBorderRadius(this._radius); 43 | 44 | final DSFRRadius _radius; 45 | 46 | BorderRadius get small => BorderRadius.all(_radius.small); 47 | 48 | @override 49 | DSFRBorderRadius copyWith({DSFRRadius? radius}) { 50 | return DSFRBorderRadius(radius ?? _radius); 51 | } 52 | 53 | @override 54 | DSFRBorderRadius lerp(ThemeExtension? other, double t) { 55 | if (other is! DSFRBorderRadius) return this; 56 | return DSFRBorderRadius(_radius.lerp(other._radius, t)); 57 | } 58 | 59 | @override 60 | bool operator ==(Object other) { 61 | return identical(this, other) || 62 | other is DSFRBorderRadius && 63 | runtimeType == other.runtimeType && 64 | _radius == other._radius; 65 | } 66 | 67 | @override 68 | int get hashCode => Object.hash(runtimeType, _radius); 69 | } 70 | -------------------------------------------------------------------------------- /lib/src/components/accordion/accordion_panel.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | import 'package:flutter_dsfr/src/components/accordion/programmable_expansion_tile.dart'; 4 | 5 | class DSFRAccordionPanel extends StatelessWidget { 6 | const DSFRAccordionPanel({ 7 | required this.data, 8 | required this.onExpandedChange, 9 | required this.accordionValue, 10 | required this.itemValue, 11 | super.key, 12 | }); 13 | 14 | final DSFRAccordionData data; 15 | final ValueChanged onExpandedChange; 16 | final UniqueKey? accordionValue; 17 | final UniqueKey itemValue; 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | final dsfrTheme = DSFRThemeData.of(context); 22 | final dsfrTypography = dsfrTheme.typography; 23 | final dsfrColors = dsfrTheme.colors; 24 | final dsfrSizes = dsfrTheme.sizes; 25 | final isExpanded = itemValue == accordionValue; 26 | 27 | return Theme( 28 | data: Theme.of(context).copyWith( 29 | splashColor: dsfrColors.splash, 30 | hoverColor: dsfrColors.hover, 31 | highlightColor: dsfrColors.active, 32 | focusColor: dsfrColors.hover, 33 | ), 34 | child: ProgrammableExpansionTile( 35 | key: Key(data.title), 36 | onExpansionChanged: (shouldBeExpanded) { 37 | if (shouldBeExpanded) { 38 | onExpandedChange(itemValue); 39 | } else { 40 | onExpandedChange(null); 41 | } 42 | }, 43 | isExpanded: isExpanded, 44 | title: DefaultTextStyle( 45 | style: (isExpanded 46 | ? dsfrTypography.boldText 47 | : dsfrTypography.defaultText) 48 | .copyWith(color: dsfrColors.text), 49 | child: Text(data.title), 50 | ), 51 | trailing: Icon( 52 | isExpanded ? DSFRIcons.substract : DSFRIcons.add, 53 | color: dsfrColors.text, 54 | size: dsfrSizes.w2, 55 | ), 56 | child: data.content, 57 | ), 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/src/components/accordion/accordion.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | import 'package:flutter_dsfr/src/components/accordion/accordion_border.dart'; 4 | import 'package:flutter_dsfr/src/components/accordion/accordion_panel.dart'; 5 | 6 | /// {@template accordion_data} 7 | /// Create an Accordion . 8 | /// Must be render inside a Scrollable widget 9 | /// 10 | /// Specs: https://gouvfr.atlassian.net/wiki/spaces/DB/pages/312082509/Accord+on+-+Accordion 11 | /// {@endtemplate} 12 | class DSFRAccordion extends StatefulWidget { 13 | /// {@macro accordion_data} 14 | const DSFRAccordion({required this.panels, super.key}); 15 | 16 | final List panels; 17 | 18 | @override 19 | State createState() => _DSFRAccordionState(); 20 | } 21 | 22 | class _DSFRAccordionState extends State { 23 | UniqueKey? accordionValue; 24 | late final itemsValues = 25 | List.generate(widget.panels.length, (_) => UniqueKey()); 26 | late final panels = widget.panels; 27 | bool initialized = false; 28 | 29 | @override 30 | void initState() { 31 | super.initState(); 32 | setDefaultAccordionValue(); 33 | } 34 | 35 | void setDefaultAccordionValue() { 36 | if (initialized) return; 37 | final lastInitialyExpandedIndex = 38 | panels.lastIndexWhere((panelData) => panelData.isInitialyExpanded); 39 | 40 | if (lastInitialyExpandedIndex != -1 && 41 | itemsValues.length == panels.length) { 42 | accordionValue = itemsValues[lastInitialyExpandedIndex]; 43 | } 44 | initialized = true; 45 | } 46 | 47 | Iterable renderPanels() sync* { 48 | for (var i = 0; i < panels.length; i++) { 49 | final isLastInGroup = i == panels.length - 1; 50 | final panelData = panels[i]; 51 | 52 | yield DSFRAccordionBorder( 53 | isLastInGroup: isLastInGroup, 54 | child: DSFRAccordionPanel( 55 | data: panelData, 56 | accordionValue: accordionValue, 57 | itemValue: itemsValues[i], 58 | onExpandedChange: (newValue) { 59 | setState(() => accordionValue = newValue); 60 | }, 61 | ), 62 | ); 63 | } 64 | } 65 | 66 | @override 67 | Widget build(BuildContext context) { 68 | return Column( 69 | mainAxisSize: MainAxisSize.min, 70 | children: [...renderPanels()], 71 | ); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.example.example" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 50 | minSdkVersion flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | } 72 | -------------------------------------------------------------------------------- /lib/src/theme/icons.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/src/utils/named_property.dart'; 3 | 4 | /// DSFRIcons, use the remix icon icon pack 5 | /// 6 | /// https://remixicon.com/ 7 | @immutable 8 | class DSFRIcons { 9 | const DSFRIcons._(); 10 | 11 | static const fontFamily = 'Remix Icon'; 12 | static const packageName = 'flutter_dsfr'; 13 | 14 | static const errorWarningFill = 15 | IconData(0xECA0, fontFamily: fontFamily, fontPackage: packageName); 16 | static const errorWarningLine = 17 | IconData(0xECA1, fontFamily: fontFamily, fontPackage: packageName); 18 | static const checkboxCircleFill = 19 | IconData(0xEB80, fontFamily: fontFamily, fontPackage: packageName); 20 | static const checkboxCircleLine = 21 | IconData(0xEB81, fontFamily: fontFamily, fontPackage: packageName); 22 | static const info = 23 | IconData(0xEE58, fontFamily: fontFamily, fontPackage: packageName); 24 | static const alertFill = 25 | IconData(0xEA20, fontFamily: fontFamily, fontPackage: packageName); 26 | static const alertLine = 27 | IconData(0xEA21, fontFamily: fontFamily, fontPackage: packageName); 28 | static const closeFill = 29 | IconData(0xEB98, fontFamily: fontFamily, fontPackage: packageName); 30 | static const flashLightFill = 31 | IconData(0xED3C, fontFamily: fontFamily, fontPackage: packageName); 32 | static const settings3Line = 33 | IconData(0xF0E6, fontFamily: fontFamily, fontPackage: packageName); 34 | static const add = 35 | IconData(0xEA12, fontFamily: fontFamily, fontPackage: packageName); 36 | static const substract = 37 | IconData(0xF1AE, fontFamily: fontFamily, fontPackage: packageName); 38 | 39 | @visibleForTesting 40 | static List> get props => const [ 41 | NamedProperty('error-warning-fill', errorWarningFill), 42 | NamedProperty('error-warning-line', errorWarningLine), 43 | NamedProperty('checkbox-circle-fill', checkboxCircleFill), 44 | NamedProperty('checkbox-circle-line', checkboxCircleLine), 45 | NamedProperty('info', info), 46 | NamedProperty('alert-fill', alertFill), 47 | NamedProperty('alert-line', alertLine), 48 | NamedProperty('close-fill', closeFill), 49 | NamedProperty('flash-light-fill', flashLightFill), 50 | NamedProperty('settings-3-line', settings3Line), 51 | NamedProperty('add', add), 52 | NamedProperty('substract', substract), 53 | ]; 54 | } 55 | -------------------------------------------------------------------------------- /lib/src/components/banners/banner.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | import 'package:flutter_dsfr/src/components/banners/banner_text.dart'; 4 | import 'package:flutter_dsfr/src/components/shared/close_button.dart'; 5 | import 'package:flutter_dsfr/src/theme/breakpoints.dart'; 6 | 7 | /// Create a banner . 8 | /// 9 | /// Specs: https://gouvfr.atlassian.net/wiki/spaces/DB/pages/992903190/Bandeau+d+information+importante 10 | class DSFRBanner extends StatelessWidget { 11 | const DSFRBanner({required this.text, this.onClose, this.link, super.key}); 12 | 13 | final String text; 14 | final VoidCallback? onClose; 15 | final DSFRBannerLink? link; 16 | 17 | EdgeInsets _getPadding(double maxWidth) { 18 | if (maxWidth > Breakpoints.lg) { 19 | return EdgeInsets.symmetric( 20 | horizontal: (maxWidth - Breakpoints.lg) / 2, 21 | ); 22 | } 23 | 24 | return EdgeInsets.zero; 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | final dsfrTheme = DSFRThemeData.of(context); 30 | final dsfrColors = dsfrTheme.colors; 31 | final dsfrSizes = dsfrTheme.sizes; 32 | 33 | final textColor = dsfrColors.info; 34 | 35 | return Container( 36 | color: dsfrColors.banner, 37 | padding: EdgeInsets.all(dsfrSizes.w2), 38 | child: LayoutBuilder( 39 | builder: (context, constraints) { 40 | final padding = _getPadding(constraints.maxWidth); 41 | 42 | return Padding( 43 | padding: padding, 44 | child: Row( 45 | crossAxisAlignment: CrossAxisAlignment.start, 46 | children: [ 47 | Icon( 48 | DSFRIcons.info, 49 | color: textColor, 50 | size: dsfrSizes.w3, 51 | ), 52 | SizedBox( 53 | width: dsfrSizes.w2, 54 | ), 55 | Expanded( 56 | child: DSFRBannerText(text: text, link: link), 57 | ), 58 | if (onClose != null) ...[ 59 | SizedBox( 60 | width: dsfrSizes.w2, 61 | ), 62 | Align( 63 | alignment: Alignment.topRight, 64 | child: SharedCloseButton(onClose: onClose!), 65 | ), 66 | ], 67 | ], 68 | ), 69 | ); 70 | }, 71 | ), 72 | ); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib/src/components/alerts/alert.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | import 'package:flutter_dsfr/src/components/alerts/alert_close_button.dart'; 4 | import 'package:flutter_dsfr/src/components/alerts/alert_icon.dart'; 5 | import 'package:flutter_dsfr/src/components/alerts/base_alert.dart'; 6 | 7 | /// Create an alert . 8 | /// 9 | /// Specs: https://gouvfr.atlassian.net/wiki/spaces/DB/pages/736362500/Alertes+-+Alerts 10 | class DSFRAlert extends BaseAlert { 11 | const DSFRAlert({ 12 | required super.type, 13 | required this.title, 14 | this.description, 15 | super.onClose, 16 | super.key, 17 | }); 18 | 19 | final String title; 20 | final String? description; 21 | 22 | EdgeInsets _getIconPadding(DSFRSizes sizes) { 23 | return EdgeInsets.fromLTRB(sizes.w1, sizes.w2, sizes.w1, sizes.w2); 24 | } 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | final dsfrTheme = DSFRThemeData.of(context); 29 | final dsfrColors = dsfrTheme.colors; 30 | final dsfrTextStyles = dsfrTheme.typography; 31 | 32 | final color = getColor(dsfrColors); 33 | 34 | return DecoratedBox( 35 | decoration: BoxDecoration( 36 | color: dsfrColors.alertsBackground, 37 | border: Border.all(color: color), 38 | ), 39 | child: IntrinsicHeight( 40 | child: Row( 41 | crossAxisAlignment: CrossAxisAlignment.stretch, 42 | children: [ 43 | AlertIcon( 44 | color: color, 45 | icon: getIconData(), 46 | padding: _getIconPadding(dsfrTheme.sizes), 47 | ), 48 | Expanded( 49 | child: Padding( 50 | padding: const EdgeInsets.all(16), 51 | child: Column( 52 | crossAxisAlignment: CrossAxisAlignment.start, 53 | children: [ 54 | Text( 55 | title, 56 | style: dsfrTextStyles.alertsTitle 57 | .copyWith(color: dsfrColors.text), 58 | ), 59 | if (description != null) 60 | Text( 61 | description!, 62 | style: DefaultTextStyle.of(context) 63 | .style 64 | .copyWith(color: dsfrColors.text), 65 | ), 66 | ], 67 | ), 68 | ), 69 | ), 70 | if (onClose != null) AlertCloseButton(onClose: onClose!), 71 | ], 72 | ), 73 | ), 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /test/components/accordion/accordion_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:alchemist/alchemist.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 4 | import 'package:flutter_test/flutter_test.dart'; 5 | 6 | const content = Padding( 7 | padding: EdgeInsets.all(8), 8 | child: Text("I'm an awesome content"), 9 | ); 10 | 11 | void main() { 12 | group('DSFRAccordion', () { 13 | final widget = GoldenTestGroup( 14 | children: [ 15 | GoldenTestScenario( 16 | name: 'solo', 17 | child: const DSFRAccordion( 18 | panels: [ 19 | DSFRAccordionData(title: "DSFRAccordion", content: content), 20 | ], 21 | ), 22 | ), 23 | GoldenTestScenario( 24 | name: 'solo - expanded', 25 | child: const DSFRAccordion( 26 | panels: [ 27 | DSFRAccordionData( 28 | title: "DSFRAccordion", 29 | content: content, 30 | isInitialyExpanded: true, 31 | ), 32 | ], 33 | ), 34 | ), 35 | GoldenTestScenario( 36 | name: 'group', 37 | child: const DSFRAccordion( 38 | panels: [ 39 | DSFRAccordionData(title: "DSFRAccordion1", content: content), 40 | DSFRAccordionData(title: "DSFRAccordion2", content: content), 41 | DSFRAccordionData(title: "DSFRAccordion3", content: content), 42 | DSFRAccordionData(title: "DSFRAccordion4", content: content), 43 | ], 44 | ), 45 | ), 46 | GoldenTestScenario( 47 | name: 'group - expanded', 48 | child: const DSFRAccordion( 49 | panels: [ 50 | DSFRAccordionData( 51 | title: "DSFRAccordion1", 52 | content: content, 53 | isInitialyExpanded: true, 54 | ), 55 | DSFRAccordionData(title: "DSFRAccordion2", content: content), 56 | DSFRAccordionData(title: "DSFRAccordion3", content: content), 57 | DSFRAccordionData(title: "DSFRAccordion4", content: content), 58 | ], 59 | ), 60 | ), 61 | ], 62 | ); 63 | 64 | goldenTest( 65 | 'renders light mode', 66 | fileName: 'accordion_light', 67 | builder: () => widget, 68 | ); 69 | 70 | goldenTest( 71 | 'renders dark mode', 72 | fileName: 'accordion_dark', 73 | builder: () => DSFRThemeWidget( 74 | data: const DSFRThemeData( 75 | colors: DSFRColors.dark(), 76 | ), 77 | child: widget, 78 | ), 79 | ); 80 | }); 81 | } 82 | -------------------------------------------------------------------------------- /lib/src/components/buttons/base_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | enum IconPosition { left, right } 4 | 5 | abstract class DSFRBaseButton extends StatelessWidget { 6 | const DSFRBaseButton({ 7 | Key? key, 8 | required String label, 9 | required VoidCallback? onPressed, 10 | Widget? icon, 11 | IconPosition iconPosition = IconPosition.left, 12 | MainAxisSize? mainAxisSize, 13 | }) : this._( 14 | key: key, 15 | label: label, 16 | icon: icon, 17 | iconPosition: iconPosition, 18 | iconOnly: false, 19 | onPressed: onPressed, 20 | mainAxisSize: mainAxisSize, 21 | ); 22 | 23 | const DSFRBaseButton._({ 24 | super.key, 25 | required this.label, 26 | required this.icon, 27 | required this.iconPosition, 28 | required this.iconOnly, 29 | required this.onPressed, 30 | required this.mainAxisSize, 31 | }) : assert( 32 | (iconOnly && label == null && icon != null) || 33 | (!iconOnly && label != null), 34 | ); 35 | 36 | const DSFRBaseButton.icon({ 37 | Key? key, 38 | required Widget icon, 39 | required VoidCallback? onPressed, 40 | }) : this._( 41 | key: key, 42 | label: null, 43 | icon: icon, 44 | iconPosition: IconPosition.left, 45 | iconOnly: true, 46 | onPressed: onPressed, 47 | mainAxisSize: MainAxisSize.min, 48 | ); 49 | 50 | /// {@template base.dsfrButtonStyleButton.onPressed} 51 | /// Called when the button is tapped or otherwise activated. 52 | /// 53 | /// If this callback is null, then the button will be disabled. 54 | /// 55 | /// See also: 56 | /// 57 | /// * [enabled], which is true if the button is enabled. 58 | /// {@endtemplate} 59 | final VoidCallback? onPressed; 60 | 61 | /// {@template base.dsfrButtonStyleButton.label} 62 | /// The button's label. 63 | /// {@endtemplate} 64 | final String? label; 65 | 66 | /// {@template base.dsfrButtonStyleButton.icon} 67 | /// The button's icon. 68 | /// {@endtemplate} 69 | final Widget? icon; 70 | 71 | final IconPosition iconPosition; 72 | 73 | final bool iconOnly; 74 | 75 | final MainAxisSize? mainAxisSize; 76 | } 77 | 78 | abstract class DSFRGroupeableButton extends DSFRBaseButton { 79 | const DSFRGroupeableButton({ 80 | super.key, 81 | required super.label, 82 | required super.onPressed, 83 | super.icon, 84 | super.iconPosition = IconPosition.left, 85 | super.mainAxisSize, 86 | }); 87 | 88 | const DSFRGroupeableButton.icon({ 89 | super.key, 90 | required super.icon, 91 | required super.onPressed, 92 | }) : super.icon(); 93 | } 94 | -------------------------------------------------------------------------------- /test/components/alerts/small_alert_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:alchemist/alchemist.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | void main() { 6 | group('DSFRAlert', () { 7 | final widget = GoldenTestGroup( 8 | columns: 4, 9 | children: [ 10 | GoldenTestScenario( 11 | name: 'error', 12 | child: const DSFRSmallAlert( 13 | description: "error alerts", 14 | type: DSFRAlertType.error, 15 | ), 16 | ), 17 | GoldenTestScenario( 18 | name: 'success', 19 | child: const DSFRSmallAlert( 20 | description: "success alerts", 21 | type: DSFRAlertType.success, 22 | ), 23 | ), 24 | GoldenTestScenario( 25 | name: 'info', 26 | child: const DSFRSmallAlert( 27 | description: "info alerts", 28 | type: DSFRAlertType.info, 29 | ), 30 | ), 31 | GoldenTestScenario( 32 | name: 'warning', 33 | child: const DSFRSmallAlert( 34 | description: "warning alerts", 35 | type: DSFRAlertType.warning, 36 | ), 37 | ), 38 | GoldenTestScenario( 39 | name: 'error - close button', 40 | child: DSFRSmallAlert( 41 | description: "error close button", 42 | type: DSFRAlertType.error, 43 | onClose: () {}, 44 | ), 45 | ), 46 | GoldenTestScenario( 47 | name: 'success - close button', 48 | child: DSFRSmallAlert( 49 | description: "success close button", 50 | type: DSFRAlertType.success, 51 | onClose: () {}, 52 | ), 53 | ), 54 | GoldenTestScenario( 55 | name: 'info - close button', 56 | child: DSFRSmallAlert( 57 | description: "info close button", 58 | type: DSFRAlertType.info, 59 | onClose: () {}, 60 | ), 61 | ), 62 | GoldenTestScenario( 63 | name: 'warning - close button', 64 | child: DSFRSmallAlert( 65 | description: "warning close button", 66 | type: DSFRAlertType.warning, 67 | onClose: () {}, 68 | ), 69 | ), 70 | ], 71 | ); 72 | 73 | goldenTest( 74 | 'renders light mode', 75 | fileName: 'small_alert_light', 76 | builder: () => widget, 77 | ); 78 | 79 | goldenTest( 80 | 'renders dark mode', 81 | fileName: 'small_alert_dark', 82 | builder: () => DSFRThemeWidget( 83 | data: const DSFRThemeData( 84 | colors: DSFRColors.dark(), 85 | ), 86 | child: widget, 87 | ), 88 | ); 89 | }); 90 | } 91 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_dsfr 2 | description: Flutter implementation of the french government design system. 3 | version: 0.0.1 4 | homepage: https://github.com/TesteurManiak/flutter_dsfr 5 | 6 | environment: 7 | sdk: ">=3.0.0 <4.0.0" 8 | flutter: ">=3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | flutter_localizations: 14 | sdk: flutter 15 | path: ^1.8.3 16 | 17 | dev_dependencies: 18 | alchemist: 19 | git: 20 | url: https://github.com/Betterment/alchemist.git 21 | ref: ab1f2eb49584339be119eaec28a5562f6b325cbc 22 | fd_lints: ^2.2.0 23 | flutter_test: 24 | sdk: flutter 25 | 26 | flutter: 27 | generate: true 28 | uses-material-design: true 29 | fonts: 30 | - family: Marianne 31 | fonts: 32 | - asset: packages/flutter_dsfr/fonts/Marianne/Marianne-Thin.otf 33 | weight: 100 34 | - asset: packages/flutter_dsfr/fonts/Marianne/Marianne-ThinItalic.otf 35 | weight: 100 36 | style: italic 37 | - asset: packages/flutter_dsfr/fonts/Marianne/Marianne-Light.otf 38 | weight: 300 39 | - asset: packages/flutter_dsfr/fonts/Marianne/Marianne-LightItalic.otf 40 | weight: 300 41 | style: italic 42 | - asset: packages/flutter_dsfr/fonts/Marianne/Marianne-Regular.otf 43 | weight: 400 44 | - asset: packages/flutter_dsfr/fonts/Marianne/Marianne-RegularItalic.otf 45 | weight: 400 46 | style: italic 47 | - asset: packages/flutter_dsfr/fonts/Marianne/Marianne-Medium.otf 48 | weight: 500 49 | - asset: packages/flutter_dsfr/fonts/Marianne/Marianne-MediumItalic.otf 50 | weight: 500 51 | style: italic 52 | - asset: packages/flutter_dsfr/fonts/Marianne/Marianne-Bold.otf 53 | weight: 700 54 | - asset: packages/flutter_dsfr/fonts/Marianne/Marianne-BoldItalic.otf 55 | weight: 700 56 | style: italic 57 | - asset: packages/flutter_dsfr/fonts/Marianne/Marianne-ExtraBold.otf 58 | weight: 800 59 | - asset: packages/flutter_dsfr/fonts/Marianne/Marianne-ExtraBoldItalic.otf 60 | weight: 800 61 | style: italic 62 | - family: Spectral 63 | fonts: 64 | - asset: packages/flutter_dsfr/fonts/Spectral/Spectral-Light.ttf 65 | weight: 300 66 | - asset: packages/flutter_dsfr/fonts/Spectral/Spectral-LightItalic.ttf 67 | weight: 300 68 | style: italic 69 | - asset: packages/flutter_dsfr/fonts/Spectral/Spectral-Regular.ttf 70 | weight: 400 71 | - asset: packages/flutter_dsfr/fonts/Spectral/Spectral-Italic.ttf 72 | weight: 400 73 | style: italic 74 | - family: Remix Icon 75 | fonts: 76 | - asset: packages/flutter_dsfr/icons/remixicon.ttf 77 | -------------------------------------------------------------------------------- /test/components/buttons/primary_button_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:alchemist/alchemist.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 4 | import 'package:flutter_test/flutter_test.dart'; 5 | 6 | void main() { 7 | group('DSFRPrimaryButton', () { 8 | final widget = GoldenTestGroup( 9 | columns: 4, 10 | children: [ 11 | GoldenTestScenario( 12 | name: 'default', 13 | child: DSFRPrimaryButton( 14 | onPressed: () {}, 15 | label: 'Label bouton', 16 | ), 17 | ), 18 | GoldenTestScenario( 19 | name: 'with icon left', 20 | child: DSFRPrimaryButton( 21 | onPressed: () {}, 22 | label: 'Label bouton', 23 | icon: const Icon(Icons.add), 24 | ), 25 | ), 26 | GoldenTestScenario( 27 | name: 'with icon right', 28 | child: DSFRPrimaryButton( 29 | onPressed: () {}, 30 | label: 'Label bouton', 31 | icon: const Icon(Icons.add), 32 | iconPosition: IconPosition.right, 33 | ), 34 | ), 35 | GoldenTestScenario( 36 | name: 'icon only', 37 | child: DSFRPrimaryButton.icon( 38 | onPressed: () {}, 39 | icon: const Icon(Icons.add), 40 | ), 41 | ), 42 | GoldenTestScenario( 43 | name: 'disabled', 44 | child: const DSFRPrimaryButton( 45 | onPressed: null, 46 | label: 'Label bouton', 47 | ), 48 | ), 49 | GoldenTestScenario( 50 | name: 'disabled with icon left', 51 | child: const DSFRPrimaryButton( 52 | onPressed: null, 53 | label: 'Label bouton', 54 | icon: Icon(Icons.add), 55 | ), 56 | ), 57 | GoldenTestScenario( 58 | name: 'disabled with icon right', 59 | child: const DSFRPrimaryButton( 60 | onPressed: null, 61 | label: 'Label bouton', 62 | icon: Icon(Icons.add), 63 | iconPosition: IconPosition.right, 64 | ), 65 | ), 66 | GoldenTestScenario( 67 | name: 'disabled icon only', 68 | child: const DSFRPrimaryButton.icon( 69 | onPressed: null, 70 | icon: Icon(Icons.add), 71 | ), 72 | ), 73 | ], 74 | ); 75 | 76 | goldenTest( 77 | 'renders light mode', 78 | fileName: 'primary_button_light', 79 | builder: () => widget, 80 | ); 81 | 82 | goldenTest( 83 | 'renders dark mode', 84 | fileName: 'primary_button_dark', 85 | builder: () => DSFRThemeWidget( 86 | data: const DSFRThemeData(colors: DSFRColors.dark()), 87 | child: widget, 88 | ), 89 | ); 90 | }); 91 | } 92 | -------------------------------------------------------------------------------- /test/components/buttons/secondary_button_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:alchemist/alchemist.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 4 | import 'package:flutter_test/flutter_test.dart'; 5 | 6 | void main() { 7 | group('DSFRSecondaryButton', () { 8 | final widget = GoldenTestGroup( 9 | columns: 4, 10 | children: [ 11 | GoldenTestScenario( 12 | name: 'default', 13 | child: DSFRSecondaryButton( 14 | onPressed: () {}, 15 | label: 'Label bouton', 16 | ), 17 | ), 18 | GoldenTestScenario( 19 | name: 'with icon left', 20 | child: DSFRSecondaryButton( 21 | onPressed: () {}, 22 | label: 'Label bouton', 23 | icon: const Icon(Icons.add), 24 | ), 25 | ), 26 | GoldenTestScenario( 27 | name: 'with icon right', 28 | child: DSFRSecondaryButton( 29 | onPressed: () {}, 30 | label: 'Label bouton', 31 | icon: const Icon(Icons.add), 32 | iconPosition: IconPosition.right, 33 | ), 34 | ), 35 | GoldenTestScenario( 36 | name: 'icon only', 37 | child: DSFRSecondaryButton.icon( 38 | onPressed: () {}, 39 | icon: const Icon(Icons.add), 40 | ), 41 | ), 42 | GoldenTestScenario( 43 | name: 'disabled', 44 | child: const DSFRSecondaryButton( 45 | onPressed: null, 46 | label: 'Label bouton', 47 | ), 48 | ), 49 | GoldenTestScenario( 50 | name: 'disabled with icon left', 51 | child: const DSFRSecondaryButton( 52 | onPressed: null, 53 | label: 'Label bouton', 54 | icon: Icon(Icons.add), 55 | ), 56 | ), 57 | GoldenTestScenario( 58 | name: 'disabled with icon right', 59 | child: const DSFRSecondaryButton( 60 | onPressed: null, 61 | label: 'Label bouton', 62 | icon: Icon(Icons.add), 63 | iconPosition: IconPosition.right, 64 | ), 65 | ), 66 | GoldenTestScenario( 67 | name: 'disabled icon only', 68 | child: const DSFRSecondaryButton.icon( 69 | onPressed: null, 70 | icon: Icon(Icons.add), 71 | ), 72 | ), 73 | ], 74 | ); 75 | 76 | goldenTest( 77 | 'renders light mode', 78 | fileName: 'secondary_button_light', 79 | builder: () => widget, 80 | ); 81 | 82 | goldenTest( 83 | 'renders dark mode', 84 | fileName: 'secondary_button_dark', 85 | builder: () => DSFRThemeWidget( 86 | data: const DSFRThemeData(colors: DSFRColors.dark()), 87 | child: widget, 88 | ), 89 | ); 90 | }); 91 | } 92 | -------------------------------------------------------------------------------- /lib/src/components/buttons/radio.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | import 'package:flutter_dsfr/src/components/buttons/base_radio.dart'; 4 | 5 | /// Specs: https://gouvfr.atlassian.net/wiki/spaces/DB/pages/217088553/Boutons+radio+-+Radio+button 6 | class DSFRRadioButton extends DSFRBaseRadio { 7 | const DSFRRadioButton({ 8 | super.key, 9 | required super.label, 10 | required super.value, 11 | required super.groupValue, 12 | required super.onChanged, 13 | super.description, 14 | super.hasError = false, 15 | this.isValid = false, 16 | }); 17 | 18 | final bool isValid; 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | final dsfrTheme = DSFRThemeData.of(context); 23 | final dsfrColors = dsfrTheme.colors; 24 | final dsfrTypography = dsfrTheme.typography; 25 | final spacings = dsfrTheme.spacings.radioSize; 26 | 27 | final Color foregroundColor; 28 | if (disabled) { 29 | foregroundColor = dsfrColors.disabledGrey; 30 | } else if (hasError) { 31 | foregroundColor = dsfrColors.defaultError; 32 | } else if (isValid) { 33 | foregroundColor = dsfrColors.defaultSuccess; 34 | } else { 35 | foregroundColor = dsfrColors.highGrey; 36 | } 37 | 38 | final Color descriptionColor; 39 | if (disabled) { 40 | descriptionColor = dsfrColors.disabledGrey; 41 | } else { 42 | descriptionColor = dsfrColors.mentionGrey; 43 | } 44 | 45 | return Theme( 46 | data: Theme.of(context).copyWith( 47 | unselectedWidgetColor: foregroundColor, 48 | radioTheme: RadioThemeData(splashRadius: spacings.size), 49 | ), 50 | child: Row( 51 | mainAxisSize: MainAxisSize.min, 52 | children: [ 53 | Radio( 54 | value: value, 55 | groupValue: groupValue, 56 | onChanged: onChanged, 57 | activeColor: dsfrColors.activeBlueFrance, 58 | materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, 59 | visualDensity: const VisualDensity( 60 | horizontal: VisualDensity.minimumDensity, 61 | vertical: VisualDensity.minimumDensity, 62 | ), 63 | ), 64 | SizedBox(width: spacings.spacing), 65 | Text.rich( 66 | TextSpan( 67 | children: [ 68 | TextSpan(text: label), 69 | if (description != null) 70 | TextSpan( 71 | text: '\n$description', 72 | style: dsfrTypography.mention 73 | .copyWith(color: descriptionColor), 74 | ), 75 | ], 76 | ), 77 | style: dsfrTypography.regular.copyWith(color: foregroundColor), 78 | ), 79 | ], 80 | ), 81 | ); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /lib/src/localization/l10n.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dsfr/src/gen/default_localizations.dart'; 4 | import 'package:flutter_dsfr/src/localization/all_languages.dart'; 5 | 6 | const _kDefaultLocale = Locale('fr'); 7 | 8 | /// {@template dsfr_localizations} 9 | /// Can be used to obtain the localized labels via [BuildContext] (using 10 | /// [labelsOf]) and to override default localizations (using 11 | /// [withDefaultOverrides]). 12 | /// {@endtemplate} 13 | class DSFRLocalizations { 14 | /// {@macro dsfr_localizations} 15 | const DSFRLocalizations(this.locale, this.labels); 16 | 17 | final Locale locale; 18 | final T labels; 19 | 20 | static DSFRLocalizations of(BuildContext context) { 21 | final l = Localizations.of(context, DSFRLocalizations); 22 | 23 | if (l != null) return l; 24 | 25 | final defaultTranslation = getDSFRTranslation(_kDefaultLocale); 26 | return DSFRLocalizations(_kDefaultLocale, defaultTranslation); 27 | } 28 | 29 | /// Returns localization labels. 30 | static DSFRLocalizationLabels labelsOf(BuildContext context) { 31 | return DSFRLocalizations.of(context).labels; 32 | } 33 | 34 | /// Localization delegate that could be provided to the 35 | /// [MaterialApp.localizationsDelegates]. 36 | static DSFRLocalizationDelegate delegate = const DSFRLocalizationDelegate(); 37 | 38 | /// Should be used to override labels provided by the library. 39 | /// 40 | /// See [DSFRLocalizationLabels]. 41 | static DSFRLocalizationDelegate 42 | withDefaultOverrides(T overrides) { 43 | return DSFRLocalizationDelegate(overrides: overrides); 44 | } 45 | } 46 | 47 | class DSFRLocalizationDelegate 48 | extends LocalizationsDelegate { 49 | const DSFRLocalizationDelegate({ 50 | this.overrides, 51 | bool forceSupportAllLocales = false, 52 | }) : _forceSupportAllLocales = forceSupportAllLocales; 53 | 54 | /// An instance of the class that overrides some labels. 55 | /// See [FirebaseUILocalizationLabels]. 56 | final T? overrides; 57 | final bool _forceSupportAllLocales; 58 | 59 | @override 60 | bool isSupported(Locale locale) { 61 | return _forceSupportAllLocales || 62 | kSupportedLanguages.contains(locale.languageCode); 63 | } 64 | 65 | @override 66 | Future> load(Locale locale) { 67 | final translation = getDSFRTranslation(locale, _kDefaultLocale); 68 | 69 | final localizations = DSFRLocalizations( 70 | locale, 71 | overrides ?? translation, 72 | ); 73 | 74 | return SynchronousFuture(localizations); 75 | } 76 | 77 | @override 78 | bool shouldReload( 79 | covariant LocalizationsDelegate> 80 | old, 81 | ) { 82 | return false; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /lib/src/theme/theme_data.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | 4 | @immutable 5 | class DSFRThemeData extends ThemeExtension { 6 | const DSFRThemeData({ 7 | required this.colors, 8 | this.buttonStyle = const DSFRButtonStyle.regular(), 9 | this.radius = const DSFRRadius.regular(), 10 | this.borderRadius = const DSFRBorderRadius(DSFRRadius.regular()), 11 | this.sizes = const DSFRSizes.regular(), 12 | this.spacings = const DSFRSpacings.medium(), 13 | this.typography = const DSFRTypography.medium(), 14 | }); 15 | 16 | final DSFRButtonStyle buttonStyle; 17 | final DSFRColors colors; 18 | final DSFRRadius radius; 19 | final DSFRBorderRadius borderRadius; 20 | final DSFRSizes sizes; 21 | final DSFRSpacings spacings; 22 | final DSFRTypography typography; 23 | 24 | static DSFRThemeData of(BuildContext context) => 25 | Theme.of(context).extension()!; 26 | 27 | @override 28 | DSFRThemeData copyWith({ 29 | DSFRButtonStyle? buttonStyle, 30 | DSFRColors? colors, 31 | DSFRRadius? radius, 32 | DSFRBorderRadius? borderRadius, 33 | DSFRSizes? sizes, 34 | DSFRSpacings? spacings, 35 | DSFRTypography? typography, 36 | }) { 37 | return DSFRThemeData( 38 | buttonStyle: buttonStyle ?? this.buttonStyle, 39 | colors: colors ?? this.colors, 40 | radius: radius ?? this.radius, 41 | borderRadius: borderRadius ?? this.borderRadius, 42 | sizes: sizes ?? this.sizes, 43 | spacings: spacings ?? this.spacings, 44 | typography: typography ?? this.typography, 45 | ); 46 | } 47 | 48 | @override 49 | ThemeExtension lerp( 50 | ThemeExtension? other, 51 | double t, 52 | ) { 53 | if (other is! DSFRThemeData) return this; 54 | return DSFRThemeData( 55 | buttonStyle: buttonStyle.lerp(other.buttonStyle, t), 56 | colors: colors.lerp(other.colors, t), 57 | radius: radius.lerp(other.radius, t), 58 | borderRadius: borderRadius.lerp(other.borderRadius, t), 59 | sizes: sizes.lerp(other.sizes, t), 60 | spacings: spacings.lerp(other.spacings, t), 61 | typography: typography.lerp(other.typography, t), 62 | ); 63 | } 64 | 65 | @override 66 | bool operator ==(Object other) { 67 | return identical(this, other) || 68 | other is DSFRThemeData && 69 | runtimeType == other.runtimeType && 70 | buttonStyle == other.buttonStyle && 71 | colors == other.colors && 72 | radius == other.radius && 73 | borderRadius == other.borderRadius && 74 | sizes == other.sizes && 75 | spacings == other.spacings && 76 | typography == other.typography; 77 | } 78 | 79 | @override 80 | int get hashCode => Object.hash( 81 | runtimeType, 82 | buttonStyle, 83 | colors, 84 | radius, 85 | borderRadius, 86 | sizes, 87 | spacings, 88 | typography, 89 | ); 90 | } 91 | -------------------------------------------------------------------------------- /lib/src/components/buttons/secondary.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' as math; 2 | import 'dart:ui'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 6 | import 'package:flutter_dsfr/src/components/buttons/base_button.dart'; 7 | 8 | class DSFRSecondaryButton extends DSFRGroupeableButton { 9 | const DSFRSecondaryButton({ 10 | super.key, 11 | required super.onPressed, 12 | required super.label, 13 | super.icon, 14 | super.iconPosition = IconPosition.left, 15 | super.mainAxisSize, 16 | }); 17 | 18 | const DSFRSecondaryButton.icon({ 19 | super.key, 20 | required super.onPressed, 21 | required super.icon, 22 | }) : super.icon(); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | final dsfrTheme = DSFRThemeData.of(context); 27 | final spacings = dsfrTheme.spacings.buttonSize; 28 | final dsfrTypography = dsfrTheme.typography; 29 | final dsfrColors = dsfrTheme.colors; 30 | final dsfrButtonStyle = dsfrTheme.buttonStyle; 31 | 32 | final scale = MediaQuery.textScalerOf(context).textScaleFactor; 33 | final double gap = 34 | scale <= 1 ? 8 : lerpDouble(8, 4, math.min(scale - 1, 1))!; 35 | 36 | final enabled = onPressed != null; 37 | final foregroundColor = enabled 38 | ? dsfrColors.borderActionHighBlueFrance 39 | : dsfrColors.textDisabledGrey; 40 | 41 | Widget? btnIcon = icon; 42 | if (btnIcon != null) { 43 | btnIcon = IconTheme( 44 | data: IconThemeData(color: foregroundColor, size: spacings.iconSize), 45 | child: btnIcon, 46 | ); 47 | } 48 | 49 | return RawMaterialButton( 50 | onPressed: onPressed, 51 | elevation: 0, 52 | fillColor: Colors.transparent, 53 | hoverColor: dsfrColors.blockColorHover, 54 | splashColor: dsfrColors.blockColorActive, 55 | shape: RoundedRectangleBorder( 56 | side: BorderSide(color: foregroundColor), 57 | ), 58 | padding: iconOnly 59 | ? EdgeInsets.all(spacings.iconPadding) 60 | : EdgeInsets.symmetric( 61 | vertical: spacings.vertical, 62 | horizontal: spacings.horizontal, 63 | ), 64 | constraints: const BoxConstraints(), 65 | textStyle: dsfrTypography.medium.copyWith(color: foregroundColor), 66 | child: iconOnly 67 | ? btnIcon 68 | : Row( 69 | mainAxisAlignment: MainAxisAlignment.center, 70 | mainAxisSize: mainAxisSize ?? dsfrButtonStyle.mainAxisSize, 71 | children: [ 72 | if (btnIcon != null && iconPosition == IconPosition.left) ...[ 73 | btnIcon, 74 | SizedBox(width: gap), 75 | ], 76 | Flexible(child: Text(label!, textAlign: TextAlign.center)), 77 | if (btnIcon != null && iconPosition == IconPosition.right) ...[ 78 | SizedBox(width: gap), 79 | btnIcon, 80 | ], 81 | ], 82 | ), 83 | ); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /example/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /lib/src/components/buttons/primary.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' as math; 2 | import 'dart:ui'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 6 | import 'package:flutter_dsfr/src/components/buttons/base_button.dart'; 7 | 8 | /// Specs: https://gouvfr.atlassian.net/wiki/spaces/DB/pages/217284660/Boutons+-+Buttons#Bouton-primaire 9 | class DSFRPrimaryButton extends DSFRGroupeableButton { 10 | const DSFRPrimaryButton({ 11 | super.key, 12 | required super.onPressed, 13 | required super.label, 14 | super.icon, 15 | super.iconPosition = IconPosition.left, 16 | super.mainAxisSize, 17 | }); 18 | 19 | const DSFRPrimaryButton.icon({ 20 | super.key, 21 | required super.icon, 22 | required super.onPressed, 23 | }) : super.icon(); 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | final dsfrTheme = DSFRThemeData.of(context); 28 | final spacings = dsfrTheme.spacings.buttonSize; 29 | final dsfrColors = dsfrTheme.colors; 30 | final dsfrTypography = dsfrTheme.typography; 31 | final dsfrButtonStyle = dsfrTheme.buttonStyle; 32 | 33 | final scale = MediaQuery.textScalerOf(context).textScaleFactor; 34 | final double gap = 35 | scale <= 1 ? 8 : lerpDouble(8, 4, math.min(scale - 1, 1))!; 36 | 37 | final enabled = onPressed != null; 38 | final backgroundColor = enabled 39 | ? dsfrColors.backgroundActionHighBlueFrance 40 | : dsfrColors.backgroundDisabledGrey; 41 | final foregroundColor = enabled 42 | ? dsfrColors.textInvertedBlueFrance 43 | : dsfrColors.textDisabledGrey; 44 | 45 | Widget? btnIcon = icon; 46 | if (btnIcon != null) { 47 | btnIcon = IconTheme( 48 | data: IconThemeData(color: foregroundColor, size: spacings.iconSize), 49 | child: btnIcon, 50 | ); 51 | } 52 | 53 | return RawMaterialButton( 54 | elevation: 0, 55 | fillColor: backgroundColor, 56 | hoverColor: dsfrColors.backgroundActionHighBlueFranceHover, 57 | splashColor: dsfrColors.backgroundActionHighBlueFranceActive, 58 | padding: iconOnly 59 | ? EdgeInsets.all(spacings.iconPadding) 60 | : EdgeInsets.symmetric( 61 | vertical: spacings.vertical, 62 | horizontal: spacings.horizontal, 63 | ), 64 | constraints: const BoxConstraints(), 65 | textStyle: dsfrTypography.medium.copyWith(color: foregroundColor), 66 | onPressed: onPressed, 67 | child: iconOnly 68 | ? btnIcon 69 | : Row( 70 | mainAxisAlignment: MainAxisAlignment.center, 71 | mainAxisSize: mainAxisSize ?? dsfrButtonStyle.mainAxisSize, 72 | children: [ 73 | if (btnIcon != null && iconPosition == IconPosition.left) ...[ 74 | btnIcon, 75 | SizedBox(width: gap), 76 | ], 77 | Flexible(child: Text(label!, textAlign: TextAlign.center)), 78 | if (btnIcon != null && iconPosition == IconPosition.right) ...[ 79 | SizedBox(width: gap), 80 | btnIcon, 81 | ], 82 | ], 83 | ), 84 | ); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /lib/src/components/buttons/tertiary.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' as math; 2 | import 'dart:ui'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 6 | import 'package:flutter_dsfr/src/components/buttons/base_button.dart'; 7 | 8 | /// Specs: https://gouvfr.atlassian.net/wiki/spaces/DB/pages/217284660/Boutons+-+Buttons#Bouton-tertiaire 9 | class DSFRTertiaryButton extends DSFRBaseButton { 10 | const DSFRTertiaryButton({ 11 | super.key, 12 | required super.onPressed, 13 | required super.label, 14 | super.icon, 15 | super.iconPosition, 16 | this.noOutline = false, 17 | }); 18 | 19 | const DSFRTertiaryButton.icon({ 20 | super.key, 21 | required super.icon, 22 | required super.onPressed, 23 | this.noOutline = false, 24 | }) : super.icon(); 25 | 26 | final bool noOutline; 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | final dsfrTheme = DSFRThemeData.of(context); 31 | final spacings = dsfrTheme.spacings.buttonSize; 32 | final dsfrColors = dsfrTheme.colors; 33 | final dsfrTypography = dsfrTheme.typography; 34 | 35 | final scale = MediaQuery.textScalerOf(context).textScaleFactor; 36 | final double gap = 37 | scale <= 1 ? 8 : lerpDouble(8, 4, math.min(scale - 1, 1))!; 38 | 39 | final enabled = onPressed != null; 40 | final foregroundColor = enabled 41 | ? dsfrColors.borderActionHighBlueFrance 42 | : dsfrColors.textDisabledGrey; 43 | 44 | Widget? btnIcon = icon; 45 | if (btnIcon != null) { 46 | btnIcon = IconTheme( 47 | data: IconThemeData(color: foregroundColor, size: spacings.iconSize), 48 | child: btnIcon, 49 | ); 50 | } 51 | 52 | return RawMaterialButton( 53 | elevation: 0, 54 | fillColor: Colors.transparent, 55 | shape: RoundedRectangleBorder( 56 | side: !noOutline 57 | ? BorderSide( 58 | color: enabled 59 | ? dsfrColors.defaultGrey 60 | : dsfrColors.textDisabledGrey, 61 | ) 62 | : BorderSide.none, 63 | ), 64 | padding: iconOnly 65 | ? EdgeInsets.all(spacings.iconPadding) 66 | : EdgeInsets.symmetric( 67 | vertical: spacings.vertical, 68 | horizontal: spacings.horizontal, 69 | ), 70 | constraints: const BoxConstraints(), 71 | textStyle: dsfrTypography.medium.copyWith(color: foregroundColor), 72 | onPressed: onPressed, 73 | child: iconOnly 74 | ? btnIcon 75 | : Row( 76 | mainAxisAlignment: MainAxisAlignment.center, 77 | mainAxisSize: MainAxisSize.min, 78 | children: [ 79 | if (btnIcon != null && iconPosition == IconPosition.left) ...[ 80 | btnIcon, 81 | SizedBox(width: gap), 82 | ], 83 | Flexible(child: Text(label!, textAlign: TextAlign.center)), 84 | if (btnIcon != null && iconPosition == IconPosition.right) ...[ 85 | SizedBox(width: gap), 86 | btnIcon, 87 | ], 88 | ], 89 | ), 90 | ); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /lib/src/components/badges/badge.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | 4 | /// Create a badge . 5 | /// 6 | /// Specs: https://gouvfr.atlassian.net/wiki/spaces/DB/pages/851869737/Badges 7 | class DSFRBadge extends StatelessWidget { 8 | const DSFRBadge({ 9 | required this.type, 10 | required this.label, 11 | this.size, 12 | this.showIcon = false, 13 | super.key, 14 | }); 15 | 16 | final DSFRBadgeType type; 17 | final String label; 18 | final DSFRBadgeSize? size; 19 | final bool showIcon; 20 | 21 | Color _getTextColor(DSFRColors dsfrColors) { 22 | switch (type) { 23 | case DSFRBadgeType.error: 24 | return dsfrColors.error; 25 | case DSFRBadgeType.success: 26 | return dsfrColors.success; 27 | case DSFRBadgeType.info: 28 | return dsfrColors.info; 29 | case DSFRBadgeType.warning: 30 | return dsfrColors.warning; 31 | case DSFRBadgeType.news: 32 | return dsfrColors.news; 33 | } 34 | } 35 | 36 | Color _getColor(DSFRColors dsfrColors) { 37 | switch (type) { 38 | case DSFRBadgeType.error: 39 | return dsfrColors.badgeError; 40 | case DSFRBadgeType.success: 41 | return dsfrColors.badgeSuccess; 42 | case DSFRBadgeType.info: 43 | return dsfrColors.badgeInfo; 44 | case DSFRBadgeType.warning: 45 | return dsfrColors.badgeWarning; 46 | case DSFRBadgeType.news: 47 | return dsfrColors.badgeNews; 48 | } 49 | } 50 | 51 | IconData _getIconData() { 52 | switch (type) { 53 | case DSFRBadgeType.error: 54 | return DSFRIcons.errorWarningFill; 55 | case DSFRBadgeType.success: 56 | return DSFRIcons.checkboxCircleFill; 57 | case DSFRBadgeType.info: 58 | return DSFRIcons.info; 59 | case DSFRBadgeType.warning: 60 | return DSFRIcons.alertFill; 61 | case DSFRBadgeType.news: 62 | return DSFRIcons.flashLightFill; 63 | } 64 | } 65 | 66 | @override 67 | Widget build(BuildContext context) { 68 | final dsfrTheme = DSFRThemeData.of(context); 69 | final dsfrColors = dsfrTheme.colors; 70 | final dsfrTypography = dsfrTheme.typography; 71 | final textColor = _getTextColor(dsfrColors); 72 | final badgeSize = size ?? dsfrTheme.spacings.badgeSize; 73 | final borderRadius = dsfrTheme.borderRadius; 74 | 75 | return Container( 76 | padding: EdgeInsets.symmetric( 77 | horizontal: badgeSize.horizontal, 78 | vertical: badgeSize.vertical, 79 | ), 80 | decoration: BoxDecoration( 81 | color: _getColor(dsfrColors), 82 | borderRadius: borderRadius.small, 83 | ), 84 | child: Row( 85 | mainAxisSize: MainAxisSize.min, 86 | children: [ 87 | if (showIcon) ...[ 88 | Icon( 89 | _getIconData(), 90 | color: textColor, 91 | size: badgeSize.iconSize, 92 | ), 93 | SizedBox(width: badgeSize.spacing), 94 | ], 95 | Text( 96 | label.toUpperCase(), 97 | style: dsfrTypography.detail.copyWith(color: textColor), 98 | ), 99 | ], 100 | ), 101 | ); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /lib/src/components/radio_group/radio_group_form_field.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | 4 | class DSFRRadioGroupFormField extends FormField { 5 | DSFRRadioGroupFormField({ 6 | super.key, 7 | required String title, 8 | required ValueChanged? onChanged, 9 | required List> items, 10 | String? description, 11 | super.onSaved, 12 | super.validator, 13 | super.autovalidateMode, 14 | this.successMessage, 15 | }) : super( 16 | builder: (state) { 17 | final context = state.context; 18 | final dsfrColors = DSFRThemeData.of(context).colors; 19 | final disabled = onChanged == null; 20 | final hasError = state.hasError && !disabled; 21 | final isValid = 22 | state.isValid && successMessage != null && !disabled; 23 | 24 | void onChangedHandler(T? value) { 25 | state.didChange(value); 26 | onChanged?.call(value); 27 | } 28 | 29 | return UnmanagedRestorationScope( 30 | bucket: state.bucket, 31 | child: Column( 32 | mainAxisSize: MainAxisSize.min, 33 | crossAxisAlignment: CrossAxisAlignment.start, 34 | children: [ 35 | DSFRRadioGroup( 36 | title: title, 37 | description: description, 38 | onChanged: onChangedHandler, 39 | items: items, 40 | hasError: state.hasError, 41 | isValid: isValid, 42 | ), 43 | if (hasError) 44 | _FormMessage( 45 | icon: DSFRIcons.alertLine, 46 | message: state.errorText!, 47 | color: dsfrColors.error, 48 | ), 49 | if (isValid) 50 | _FormMessage( 51 | icon: DSFRIcons.checkboxCircleLine, 52 | message: successMessage, 53 | color: dsfrColors.success, 54 | ), 55 | ], 56 | ), 57 | ); 58 | }, 59 | ); 60 | 61 | final String? successMessage; 62 | } 63 | 64 | class _FormMessage extends StatelessWidget { 65 | const _FormMessage({ 66 | required this.icon, 67 | required this.message, 68 | required this.color, 69 | }); 70 | 71 | final IconData icon; 72 | final String message; 73 | final Color color; 74 | 75 | @override 76 | Widget build(BuildContext context) { 77 | final dsfrTheme = DSFRThemeData.of(context); 78 | final dsfrTypography = dsfrTheme.typography; 79 | final dsfrSizes = dsfrTheme.sizes; 80 | 81 | return Padding( 82 | padding: EdgeInsets.only(top: dsfrSizes.v3), 83 | child: Row( 84 | children: [ 85 | Icon( 86 | icon, 87 | color: color, 88 | size: (dsfrTypography.mention.fontSize ?? 12.0) + 2, 89 | ), 90 | const SizedBox(width: 2), 91 | Text( 92 | message, 93 | style: dsfrTypography.mention 94 | .copyWith(color: color, fontWeight: FontWeight.normal), 95 | ), 96 | ], 97 | ), 98 | ); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /lib/src/components/radio_group/radio_group.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dsfr/flutter_dsfr.dart'; 3 | 4 | @immutable 5 | class DSFRRadioData { 6 | const DSFRRadioData({ 7 | required this.label, 8 | required this.value, 9 | this.description, 10 | }); 11 | 12 | final String label; 13 | final String? description; 14 | final T value; 15 | 16 | DSFRRadioData copyWith({ 17 | String? label, 18 | String? description, 19 | T? value, 20 | bool? hasError, 21 | }) { 22 | return DSFRRadioData( 23 | label: label ?? this.label, 24 | description: description ?? this.description, 25 | value: value ?? this.value, 26 | ); 27 | } 28 | } 29 | 30 | class DSFRRadioGroup extends StatefulWidget { 31 | const DSFRRadioGroup({ 32 | super.key, 33 | required this.title, 34 | required this.onChanged, 35 | required this.items, 36 | this.direction = Axis.vertical, 37 | this.description, 38 | this.hasError = false, 39 | this.isValid = false, 40 | }) : assert(items.length > 0); 41 | 42 | final String title; 43 | final String? description; 44 | final ValueChanged? onChanged; 45 | final List> items; 46 | final Axis direction; 47 | final bool hasError; 48 | final bool isValid; 49 | 50 | @override 51 | State> createState() => _DSFRRadioGroupState(); 52 | } 53 | 54 | class _DSFRRadioGroupState extends State> { 55 | T? _groupValue; 56 | 57 | @override 58 | Widget build(BuildContext context) { 59 | final dsfrTheme = DSFRThemeData.of(context); 60 | final dsfrTypography = dsfrTheme.typography; 61 | final dsfrColors = dsfrTheme.colors; 62 | final dsfrSizes = dsfrTheme.sizes; 63 | final description = widget.description; 64 | 65 | final disabled = widget.onChanged == null; 66 | 67 | return Column( 68 | mainAxisSize: MainAxisSize.min, 69 | crossAxisAlignment: CrossAxisAlignment.start, 70 | children: [ 71 | Text.rich( 72 | TextSpan( 73 | children: [ 74 | TextSpan(text: widget.title), 75 | if (description != null) 76 | TextSpan( 77 | text: '\n$description', 78 | style: dsfrTypography.mention.copyWith( 79 | color: dsfrColors.mentionGrey, 80 | ), 81 | ), 82 | ], 83 | ), 84 | style: dsfrTypography.regular.copyWith(color: dsfrColors.titleGrey), 85 | ), 86 | SizedBox(height: dsfrSizes.v3), 87 | Wrap( 88 | direction: widget.direction, 89 | runSpacing: dsfrSizes.v3, 90 | spacing: dsfrSizes.v3, 91 | children: widget.items 92 | .map>( 93 | (e) => DSFRRadioButton( 94 | label: e.label, 95 | description: e.description, 96 | value: e.value, 97 | groupValue: _groupValue, 98 | onChanged: disabled ? null : _onChangedHandler, 99 | hasError: widget.hasError, 100 | isValid: widget.isValid, 101 | ), 102 | ) 103 | .toList(), 104 | ), 105 | ], 106 | ); 107 | } 108 | 109 | void _onChangedHandler(T? value) { 110 | setState(() => _groupValue = value); 111 | widget.onChanged?.call(value); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /example/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "example" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "example.exe" "\0" 98 | VALUE "ProductName", "example" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | --------------------------------------------------------------------------------