Skip to content

Commit

Permalink
feat: Added Divider95 Widget (#25)
Browse files Browse the repository at this point in the history
- Added Tests
- Added Example
- Added Docs
  • Loading branch information
Taosif7 authored Oct 24, 2023
1 parent a99689d commit 18a3a0a
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 3 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@ Tooltip95(

<img src="https://github.com/miquelbeltran/flutter95/raw/master/art/tooltip95.png" alt="Tooltip95" width="200"/>

#### Divider95

A divider widget designed in Windows95 style.
* Works just like Material's `Divider`.
* Supports indent, endIndent and height.

```dart
Divider95()
```

<img src="https://github.com/miquelbeltran/flutter95/raw/master/art/divider95.png" alt="Divider95" width="200"/>

#### Elevation95

Creates an effect of deepness and elevation around Widgets.
Expand Down
Binary file added art/divider95.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ class MainScreen extends StatelessWidget {

final ValueNotifier<bool> checkboxValue = ValueNotifier<bool>(false);

final _divider = const Divider95(
height: 20,
endIndent: 8,
indent: 8,
);

@override
Widget build(BuildContext context) {
return Scaffold95(
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/flutter95.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
29 changes: 29 additions & 0 deletions lib/src/divider95.dart
Original file line number Diff line number Diff line change
@@ -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,
),
),
);
}
}
13 changes: 13 additions & 0 deletions test/flutter95_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
}

0 comments on commit 18a3a0a

Please sign in to comment.