Skip to content

Instantly share code, notes, and snippets.

@VB10
Last active January 23, 2020 19:28
Show Gist options
  • Select an option

  • Save VB10/814d09f83ec3372a483ec74555e9c2de to your computer and use it in GitHub Desktop.

Select an option

Save VB10/814d09f83ec3372a483ec74555e9c2de to your computer and use it in GitHub Desktop.
Rounded Button
import 'package:flutter/material.dart';
import '../../theme.dart';
import '../../ui_helper.dart';
import '../padding/base_padding.dart';
import '../padding/base_padding_enum.dart';
import '../text/subtitle.dart';
import 'circle_card.dart';
import 'rounded_rectange_card.dart';
class IconLabelCard extends StatelessWidget {
final String title;
final String decription;
final IconData icon;
final VoidCallback onPressed;
IconLabelCard({
Key key,
@required this.title,
@required this.decription,
@required this.icon,
@required this.onPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return RoundedRectangleCard(
color: greyCardColor,
child: InkWell(onTap: onPressed, child: _listTile),
);
}
Widget get _listTile => ListTile(
contentPadding: EdgeInsets.all(SpaceValue.VERY_LOW),
title: Text(title),
subtitle: SubTitleText(decription),
leading: CircleCard(borderColor: yellowSearchCardColor, child: _icon),
);
Widget get _icon => BasePadding(
level: BasePaddingLevel.LOW,
child: Icon(icon, color: yellowSearchCardColor),
);
}
import 'package:flutter/material.dart';
import 'package:healthoui/ui/shared/widget/text/subtitle.dart';
class ListViewHeader extends StatelessWidget {
final String leftText;
final String righText;
final Color rightColor;
final Color leftColor;
final VoidCallback onPressed;
const ListViewHeader(
{Key key,
@required this.leftText,
@required this.righText,
this.rightColor,
this.leftColor,
this.onPressed})
: super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onPressed,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(leftText),
SubTitleText(righText, color: rightColor),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:healthoui/ui/shared/widget/padding/base_padding_enum.dart';
class RoundedTextButton extends StatelessWidget {
final Color color;
final VoidCallback onPressed;
final String title;
final BasePaddingLevel spaceLevel;
const RoundedTextButton(
{Key key,
this.color,
@required this.onPressed,
@required this.title,
this.spaceLevel})
: super(key: key);
@override
Widget build(BuildContext context) {
return RaisedButton(
padding: EdgeInsets.all(_spaceValue),
color: color,
shape: StadiumBorder(),
child: Text(
title,
style: Theme.of(context)
.textTheme
.subhead
.copyWith(fontWeight: FontWeight.w600),
),
onPressed: onPressed,
);
}
double get _spaceValue {
switch (spaceLevel) {
case BasePaddingLevel.VERY_LOW:
return 15;
case BasePaddingLevel.LOW:
return 20;
case BasePaddingLevel.MIDDLE:
return 40;
case BasePaddingLevel.HIGH:
return 60;
default:
return 10;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment