Skip to content

Commit

Permalink
feat: add alert
Browse files Browse the repository at this point in the history
  • Loading branch information
pd4d10 committed May 3, 2019
1 parent 7e18157 commit 75695c3
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
1 change: 1 addition & 0 deletions examples/gallery/lib/main.dart
Expand Up @@ -97,6 +97,7 @@ class _MyHomePageState extends State<MyHomePage> {
StateLabel(StateLabelStatus.issueOpened),
StateLabel(StateLabelStatus.issueClosed),
StateLabel(StateLabelStatus.pullMerged),
Alert('Flash message goes here.'),
BranchName('a_new_feature_branch'),
Text(
'You have pushed the button this many times:',
Expand Down
2 changes: 2 additions & 0 deletions lib/primer.dart
@@ -1,3 +1,5 @@
export 'src/utils.dart';
export 'src/label.dart';
export 'src/colors.dart';
export 'src/branch_name.dart';
export 'src/alert.dart';
26 changes: 26 additions & 0 deletions lib/src/alert.dart
@@ -0,0 +1,26 @@
import 'package:flutter/widgets.dart';
import 'colors.dart';
import 'utils.dart';

class Alert extends StatelessWidget {
final String text;
final PrimerTheme theme;

Alert(this.text, {this.theme});

@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
color: PrimerColors.blue100,
borderRadius: BorderRadius.all(Radius.circular(3)),
border: Border.all(color: Color(0x1b1f2326), width: 1),
),
child: Text(
text,
style: TextStyle(color: PrimerColors.blue800),
),
);
}
}
8 changes: 1 addition & 7 deletions lib/src/label.dart
@@ -1,16 +1,10 @@
import 'package:flutter/widgets.dart';
import 'octicons.dart';
import 'colors.dart';
import 'utils.dart';

const openGreen = Color(0xff2cbe4e);

enum PrimerTheme {
primary,
warn,
error,
success,
}

Map<PrimerTheme, Color> colorMap = {
PrimerTheme.primary: PrimerColors.blue500,
};
Expand Down
6 changes: 6 additions & 0 deletions lib/src/utils.dart
@@ -0,0 +1,6 @@
enum PrimerTheme {
primary,
warn,
error,
success,
}

0 comments on commit 75695c3

Please sign in to comment.