Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added example/assets/fonts/opensans.ttf
Binary file not shown.
Binary file added example/assets/fonts/robotomono.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ void main() async {
WidgetsFlutterBinding.ensureInitialized();
await FlutterSkin.init(
apiKey:
"fsk_b0ce429cfbded17bbca66eef6e68bd1f0b7fbf9d74be0c3a0ac8b2e0554b7919",
"fsk_dc0054468a27dde1671142669f2065f93870975bbb773f1af0ab5898797956db",
);
runApp(const MyApp());
}
Expand Down
25 changes: 19 additions & 6 deletions example/lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ class _MyHomePageState extends State<MyHomePage> {
],
),
),
child: Text(movie.title, style: TextStyle(color: Theme.of(context).colorScheme.onTertiary)),
child: Text(
movie.title,
style: TextStyle(color: Theme.of(context).colorScheme.onTertiary),
),
),
content: SingleChildScrollView(
child: Column(
Expand All @@ -202,12 +205,22 @@ class _MyHomePageState extends State<MyHomePage> {
),
actions: [
TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Theme.of(context).colorScheme.secondaryContainer),
foregroundColor: MaterialStateProperty.all(Theme.of(context).colorScheme.onSecondaryContainer),
onPressed: () {
Navigator.pop(context);
},
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.tertiaryContainer,
borderRadius: BorderRadius.circular(4),
),
child: Text(
'Close',
style: TextStyle(
color: Theme.of(context).colorScheme.onTertiaryContainer,
),
),
),
Comment on lines +208 to 223

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 2 \
  'environment:|sdk:|flutter:|flutter-version|channel:' \
  --glob 'pubspec.yaml' \
  --glob 'pubspec.lock' \
  --glob '.fvmrc' \
  --glob 'fvm_config.json' \
  --glob '*.yml' \
  --glob '*.yaml' \
  . || true

Repository: koukibadr/flutter_skin

Length of output: 2047


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Repository SDK declarations:\n'
rg -n 'environment:|sdk:|flutter:|packageInfo|flutter_version|minimum_supported|requires_flutter|pubspec' \
  --glob 'pubspec.yaml' --glob 'README.md' --glob '.github/**' --glob 'analysis_options.yaml' . || true

printf '\nRelevant home_page.dart section:\n'
wc -l example/lib/pages/home_page.dart
sed -n '180,245p' example/lib/pages/home_page.dart

printf '\nFind ColorScheme.tertiaryContainer usages:\n'
rg -n 'onTertiaryContainer|tertiaryContainer' . || true

Repository: koukibadr/flutter_skin

Length of output: 3019


Keep the Flutter lower bound consistent with the new color roles.

tertiaryContainer and onTertiaryContainer require a Flutter version newer than >=1.17.0, but pubspec.yaml still declares that lower bound and allows clients to run with an unsupported SDK. Raise the flutter constraint above the version that introduced these ColorScheme roles.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@example/lib/pages/home_page.dart` around lines 210 - 228, Raise the Flutter
SDK lower bound in pubspec.yaml above the version that introduced
ColorScheme.tertiaryContainer and onTertiaryContainer, keeping the constraint
consistent with the roles used by the Close button in the surrounding widget.

Source: MCP tools

onPressed: () => Navigator.pop(context),
child: const Text('Close'),
),
],
),
Expand Down
18 changes: 7 additions & 11 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,13 @@ flutter:
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
fonts:
- family: OpenSans
fonts:
- asset: assets/fonts/opensans.ttf
- family: Roboto
fonts:
- asset: assets/fonts/robotomono.ttf
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/to/font-from-package
9 changes: 8 additions & 1 deletion lib/flutter_skin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class FlutterSkin with WidgetsBindingObserver {
static Stream<ThemeData> get onSkinChanged => remoteConfig.onSkinChanged;
static final FskinLogger _logger = FskinLogger();

/// Returns the font family of the current active theme from the remote configuration.
static String? get themeFont => remoteConfig.projectConfig?.skin?.fontFamily;

// Private constructor
FlutterSkin._();

Expand Down Expand Up @@ -88,7 +91,11 @@ class FlutterSkin with WidgetsBindingObserver {
static ThemeData? toThemeData({ThemeData? fallbackTheme}) {
ProjectConfig? config = remoteConfig.projectConfig;
ColorScheme? colors = config?.skin?.colors;
ThemeData remoteTheme = ThemeData(colorScheme: colors);
String? fontFamily = config?.skin?.fontFamily;
ThemeData remoteTheme = ThemeData(
colorScheme: colors,
fontFamily: fontFamily,
);
if (colors == null) {
if (fallbackTheme != null) {
_logger.logWarning('No active theme found. Returning fallback theme.');
Expand Down
3 changes: 3 additions & 0 deletions lib/models/skin_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class SkinModel {
final DateTime? publishedAt;
final DateTime? deletedAt;
final ColorScheme? colors;
final String? fontFamily;

SkinModel({
required this.id,
Expand All @@ -18,6 +19,7 @@ class SkinModel {
required this.version,
required this.createdAt,
required this.colors,
this.fontFamily,
this.publishedAt,
this.deletedAt,
});
Expand All @@ -42,6 +44,7 @@ class SkinModel {
colors: tokens is Map<String, dynamic>
? fromSchemaString(tokens)?.colors
: null,
fontFamily: map['font'] as String?,
);
}

Expand Down
Loading