Skip to content

Commit

Permalink
feat: add blankslate
Browse files Browse the repository at this point in the history
  • Loading branch information
pd4d10 committed May 3, 2019
1 parent 75695c3 commit 2710340
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/gallery/lib/main.dart
Expand Up @@ -99,6 +99,15 @@ class _MyHomePageState extends State<MyHomePage> {
StateLabel(StateLabelStatus.pullMerged),
Alert('Flash message goes here.'),
BranchName('a_new_feature_branch'),
Blankslate(
child: Column(
children: <Widget>[
BlankslateTitle('This is a blank slate'),
Text(
'Use it to provide information when no dynamic content exists.'),
],
),
),
Text(
'You have pushed the button this many times:',
),
Expand Down
1 change: 1 addition & 0 deletions lib/primer.dart
Expand Up @@ -3,3 +3,4 @@ export 'src/label.dart';
export 'src/colors.dart';
export 'src/branch_name.dart';
export 'src/alert.dart';
export 'src/blankslate.dart';
46 changes: 46 additions & 0 deletions lib/src/blankslate.dart
@@ -0,0 +1,46 @@
import 'package:flutter/widgets.dart';
import 'colors.dart';

class Blankslate extends StatelessWidget {
final Widget child;
final bool spacious;
final bool cleanBackground;

Blankslate({this.child, this.spacious = false, this.cleanBackground = false});

@override
Widget build(BuildContext context) {
return Container(
padding: spacious
? EdgeInsets.symmetric(vertical: 80, horizontal: 40)
: EdgeInsets.all(32),
decoration: BoxDecoration(
color: cleanBackground ? null : PrimerColors.gray000,
borderRadius: BorderRadius.all(Radius.circular(3)),
border: cleanBackground
? null
: Border.all(color: PrimerColors.gray200, width: 1),
),
child: child,
);
}
}

class BlankslateTitle extends StatelessWidget {
final String text;

BlankslateTitle(this.text);

@override
Widget build(BuildContext context) {
return Text(
text,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: PrimerColors.gray900,
height: 1.5,
),
);
}
}

0 comments on commit 2710340

Please sign in to comment.