-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Nuxify/feature/provide-other-widgets
feat: provide other widgets
- Loading branch information
Showing
11 changed files
with
171 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:shimmer/shimmer.dart'; | ||
|
||
/// These are the static widgets that we're gonna use as skeleton loaders. | ||
/// We use the Text Widget with dummy values to emulate the the exact dimensions of specific widgets | ||
/// The text values won't show up because they are overlapped by the shimmer effect. It's just for height and width purposes. | ||
const Duration fadeInDuration = Duration(milliseconds: 500); | ||
|
||
class CardExpandedLoader extends StatelessWidget { | ||
const CardExpandedLoader({ | ||
required this.height, | ||
this.baseColor = const Color(0xFF607D8B), | ||
this.highlightColor = const Color(0xFFCFD8DC), | ||
super.key, | ||
}); | ||
final double height; | ||
final Color baseColor; | ||
final Color highlightColor; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Shimmer.fromColors( | ||
baseColor: baseColor, | ||
highlightColor: highlightColor, | ||
child: Container( | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(8), | ||
color: baseColor.withOpacity(0.1), | ||
), | ||
margin: const EdgeInsets.only(right: 8), | ||
height: height, | ||
), | ||
); | ||
} | ||
} | ||
|
||
class CardLoader extends StatelessWidget { | ||
const CardLoader({ | ||
required this.height, | ||
required this.width, | ||
this.baseColor = const Color(0xFF607D8B), | ||
this.highlightColor = const Color(0xFFCFD8DC), | ||
super.key, | ||
}); | ||
final double height; | ||
final double width; | ||
final Color baseColor; | ||
final Color highlightColor; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Shimmer.fromColors( | ||
baseColor: baseColor, | ||
highlightColor: highlightColor, | ||
child: Container( | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(8), | ||
color: baseColor.withOpacity(0.1), | ||
), | ||
margin: const EdgeInsets.only(right: 8), | ||
height: height, | ||
width: width, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
|
||
/// A custom status bar widget with configurable colors and brightness for status and navigation bars. | ||
/// | ||
/// [backgroundColor] sets the background color of the AppBar. | ||
/// | ||
/// [statusBarColor] changes the color of the status bar. | ||
/// | ||
/// [brightness] describes the contrast of a theme or color palette. | ||
class AppStatusBar extends StatelessWidget implements PreferredSizeWidget { | ||
const AppStatusBar({ | ||
required this.brightness, | ||
this.backgroundColor, | ||
this.statusBarColor, | ||
Key? key, | ||
}) : super(key: key); | ||
final Color? backgroundColor; | ||
final Color? statusBarColor; | ||
final Brightness brightness; | ||
|
||
@override | ||
Size get preferredSize => const Size.fromHeight(0); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return PreferredSize( | ||
preferredSize: const Size(double.infinity, 0), | ||
child: AppBar( | ||
toolbarHeight: 0, | ||
elevation: 0, | ||
backgroundColor: backgroundColor, | ||
systemOverlayStyle: SystemUiOverlayStyle( | ||
statusBarIconBrightness: brightness, | ||
statusBarBrightness: brightness, | ||
systemNavigationBarIconBrightness: brightness, | ||
statusBarColor: statusBarColor, | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:nuxify_widgetbook/indicators/widget_loader.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook; | ||
|
||
@widgetbook.UseCase(name: 'Default', type: CardExpandedLoader) | ||
Widget defaultUseCase(BuildContext context) { | ||
final int itemCount = | ||
context.knobs.int.slider(label: 'Loader Count', initialValue: 3, max: 10); | ||
|
||
return Center( | ||
child: Container( | ||
color: | ||
!context.knobs.boolean(label: 'Dark background.', initialValue: true) | ||
? const Color(0xFFF5F7F8) | ||
: const Color(0xFF1E201E), | ||
padding: const EdgeInsets.symmetric(horizontal: 50), | ||
child: Center( | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
for (int j = 0; j < itemCount; j++) | ||
Padding( | ||
padding: const EdgeInsets.only(bottom: 10.0), | ||
child: CardExpandedLoader( | ||
height: context.knobs.double | ||
.input(label: 'Card Loader Height', initialValue: 50), | ||
), | ||
) | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters