diff --git a/README.md b/README.md index 538da2d..e2ba44f 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,18 @@ Tooltip95( Tooltip95 +#### Divider95 + +A divider widget designed in Windows95 style. +* Works just like Material's `Divider`. +* Supports indent, endIndent and height. + +```dart +Divider95() +``` + +Divider95 + #### Elevation95 Creates an effect of deepness and elevation around Widgets. diff --git a/art/divider95.png b/art/divider95.png new file mode 100644 index 0000000..56364f5 Binary files /dev/null and b/art/divider95.png differ diff --git a/example/lib/main.dart b/example/lib/main.dart index 97b63a2..87457a5 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -24,6 +24,12 @@ class MainScreen extends StatelessWidget { final ValueNotifier checkboxValue = ValueNotifier(false); + final _divider = const Divider95( + height: 20, + endIndent: 8, + indent: 8, + ); + @override Widget build(BuildContext context) { return Scaffold95( @@ -95,15 +101,15 @@ class MainScreen extends StatelessWidget { 'Text with Flutter95.textStyle', style: Flutter95.textStyle, ), - const SizedBox(height: 4), + _divider, const Tooltip95( message: 'Hello from Flutter95!', child: Text( - 'Long press this on to see a tooltip', + 'Long press on this to see a tooltip', style: Flutter95.textStyle, ), ), - const SizedBox(height: 4), + _divider, Button95( onTap: () { showDialog95( diff --git a/lib/flutter95.dart b/lib/flutter95.dart index 55da0b2..d9717da 100644 --- a/lib/flutter95.dart +++ b/lib/flutter95.dart @@ -11,4 +11,5 @@ export 'src/checkbox95.dart'; export 'src/toolbar95.dart'; export 'src/tooltip95.dart'; export 'src/page_transitions95.dart'; +export 'src/divider95.dart'; export 'src/utils.dart'; diff --git a/lib/src/divider95.dart b/lib/src/divider95.dart new file mode 100644 index 0000000..47cc7cc --- /dev/null +++ b/lib/src/divider95.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:flutter95/flutter95.dart'; + +class Divider95 extends StatelessWidget { + final double height; + final double indent; + final double endIndent; + + const Divider95({ + super.key, + this.height = 16.0, + this.indent = 0.0, + this.endIndent = 0.0, + }); + + @override + Widget build(BuildContext context) { + return SizedBox( + height: height, + child: Center( + child: Container( + height: 3, + margin: EdgeInsetsDirectional.only(start: indent, end: endIndent), + decoration: Flutter95.pressedDecorationOutside, + ), + ), + ); + } +} diff --git a/test/flutter95_test.dart b/test/flutter95_test.dart index 8510241..72db2ff 100644 --- a/test/flutter95_test.dart +++ b/test/flutter95_test.dart @@ -131,4 +131,17 @@ void main() { expect(find.byKey(const Key('checkbox95Key')), findsOneWidget); }); }); + + group('Divider95', () { + testWidgets('Can build widget', (tester) async { + await tester.pumpWidget( + const MaterialApp( + home: Divider95( + key: Key('Divider95Key'), + ), + ), + ); + expect(find.byKey(const Key('Divider95Key')), findsOneWidget); + }); + }); }