Skip to content

Commit

Permalink
Add custom spinner styling
Browse files Browse the repository at this point in the history
  • Loading branch information
kra-mo committed Sep 11, 2024
1 parent 3af097e commit 7867f04
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
9 changes: 8 additions & 1 deletion lib/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ class SlyButtonState extends State<SlyButton> {
);
return CupertinoTheme(
data: const CupertinoThemeData(brightness: Brightness.light),
child: Theme(data: ThemeData.light(), child: elevatedButton!),
child: Theme(
data: ThemeData(
colorScheme: ColorScheme.fromSwatch(
primarySwatch: Colors.grey,
brightness: Brightness.light,
),
),
child: elevatedButton!),
);
}

Expand Down
7 changes: 4 additions & 3 deletions lib/editor_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'button.dart';
import 'slider_row.dart';
import 'switch.dart';
import 'toggle_buttons.dart';
import 'spinner.dart';
import 'dialog.dart';
import 'snack_bar.dart';
import 'title_bar.dart';
Expand Down Expand Up @@ -67,7 +68,7 @@ class _SlyEditorPageState extends State<SlyEditorPage> {
child: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator.adaptive(),
child: SlySpinner(),
),
),
);
Expand Down Expand Up @@ -333,7 +334,7 @@ class _SlyEditorPageState extends State<SlyEditorPage> {
width: _thumbnail.width.toDouble(),
height: _thumbnail.height.toDouble(),
child: const Center(
child: CircularProgressIndicator.adaptive(),
child: SlySpinner(),
),
),
);
Expand All @@ -356,7 +357,7 @@ class _SlyEditorPageState extends State<SlyEditorPage> {
},
)
: const Center(
child: CircularProgressIndicator.adaptive(),
child: SlySpinner(),
),
),
);
Expand Down
3 changes: 2 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:image_picker/image_picker.dart';
import 'utils.dart';
import 'image.dart';
import 'button.dart';
import 'spinner.dart';
import 'editor_page.dart';
import 'snack_bar.dart';
import 'title_bar.dart';
Expand Down Expand Up @@ -92,7 +93,7 @@ class _SlyHomePageState extends State<SlyHomePage> {
child: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator.adaptive(),
child: SlySpinner(),
),
),
);
Expand Down
4 changes: 3 additions & 1 deletion lib/snack_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'dart:ui' as ui;

import 'package:flutter/material.dart';

import 'spinner.dart';

void showSlySnackBar(
BuildContext context,
String message, {
Expand Down Expand Up @@ -36,7 +38,7 @@ void showSlySnackBar(
? const SizedBox(
width: 16,
height: 16,
child: CircularProgressIndicator.adaptive(),
child: SlySpinner(),
)
: Container(),
loading ? const SizedBox(width: 16) : Container(),
Expand Down
9 changes: 9 additions & 0 deletions lib/spinner.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:flutter/material.dart';

class SlySpinner extends CircularProgressIndicator {
const SlySpinner({super.key})
: super.adaptive(
strokeWidth: 5,
strokeCap: StrokeCap.round,
);
}

0 comments on commit 7867f04

Please sign in to comment.