Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
.pub/

build/

.vscode
.idea
Binary file added example/assets/profilpic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:babstrap_settings_screen/babstrap_settings_screen.dart';

void main() {
runApp(MyApp());
}
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
Expand All @@ -17,7 +15,10 @@ class MyApp extends StatelessWidget {
appBar: AppBar(
title: Text(
"Settings",
style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
centerTitle: true,
backgroundColor: Colors.transparent,
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ flutter:
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
assets:
- assets/
# - images/a_dot_ham.jpeg

# An image asset can refer to one or more resolution-specific "variants", see
Expand Down
17 changes: 9 additions & 8 deletions lib/src/babs_component_big_user_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import 'package:flutter/material.dart';
class BigUserCard extends StatelessWidget {
final Color? backgroundColor;
final Color? settingColor;
final double? cardRadius;
final Color? backgroundMotifColor;
final double cardRadius;
final Color backgroundMotifColor;
final Widget? cardActionWidget;
final String? userName;
final String userName;
final Widget? userMoreInfo;
final ImageProvider userProfilePic;

Expand All @@ -29,23 +29,24 @@ class BigUserCard extends StatelessWidget {
margin: EdgeInsets.only(bottom: 20),
decoration: BoxDecoration(
color: backgroundColor ?? Theme.of(context).cardColor,
borderRadius:
BorderRadius.circular(double.parse(cardRadius!.toString())),
borderRadius: BorderRadius.circular(
double.parse(cardRadius.toString()),
),
),
child: Stack(
children: [
Align(
alignment: Alignment.bottomLeft,
child: CircleAvatar(
radius: 100,
backgroundColor: backgroundMotifColor!.withOpacity(.1),
backgroundColor: backgroundMotifColor.withOpacity(.1),
),
),
Align(
alignment: Alignment.center,
child: CircleAvatar(
radius: 400,
backgroundColor: backgroundMotifColor!.withOpacity(.05),
backgroundColor: backgroundMotifColor.withOpacity(.05),
),
),
Container(
Expand Down Expand Up @@ -73,7 +74,7 @@ class BigUserCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
userName!,
userName,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: mediaQueryHeight / 30,
Expand Down
24 changes: 10 additions & 14 deletions lib/src/babs_component_settings_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ class SettingsGroup extends StatelessWidget {
final TextStyle? settingsGroupTitleStyle;
final List<SettingsItem> items;
// Icons size
final double? iconItemSize;
final double iconItemSize;

SettingsGroup(
{this.settingsGroupTitle,
this.settingsGroupTitleStyle,
required this.items,
this.iconItemSize = 25});
SettingsGroup({
this.settingsGroupTitle,
this.settingsGroupTitleStyle,
required this.items,
this.iconItemSize = 25,
});

@override
Widget build(BuildContext context) {
if (this.iconItemSize != null)
SettingsScreenUtils.settingsGroupIconSize = iconItemSize;
SettingsScreenUtils.settingsGroupIconSize = iconItemSize;

return Container(
margin: EdgeInsets.only(bottom: 20),
Expand All @@ -46,13 +46,9 @@ class SettingsGroup extends StatelessWidget {
borderRadius: BorderRadius.circular(15),
),
child: ListView.separated(
separatorBuilder: (context, index) {
return Divider();
},
separatorBuilder: (context, index) => Divider(),
itemCount: items.length,
itemBuilder: (BuildContext context, int index) {
return items[index];
},
itemBuilder: (BuildContext context, int index) => items[index],
shrinkWrap: true,
padding: EdgeInsets.zero,
physics: ScrollPhysics(),
Expand Down
25 changes: 13 additions & 12 deletions lib/src/babs_component_settings_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,29 @@ class SettingsItem extends StatelessWidget {
final VoidCallback? onTap;
final Color? backgroundColor;

SettingsItem(
{required this.icons,
this.iconStyle,
required this.title,
this.titleStyle,
this.subtitle,
this.subtitleStyle,
this.backgroundColor,
this.trailing,
this.onTap});
SettingsItem({
required this.icons,
this.iconStyle,
required this.title,
this.titleStyle,
this.subtitle,
this.subtitleStyle,
this.backgroundColor,
this.trailing,
this.onTap,
});

@override
Widget build(BuildContext context) {
return ClipRRect(
borderRadius: BorderRadius.circular(15),
child: ListTile(
onTap: onTap,
leading: (iconStyle != null && iconStyle!.withBackground!)
leading: (iconStyle != null && iconStyle!.withBackground)
? Container(
decoration: BoxDecoration(
color: iconStyle!.backgroundColor,
borderRadius: BorderRadius.circular(iconStyle!.borderRadius!),
borderRadius: BorderRadius.circular(iconStyle!.borderRadius),
),
padding: EdgeInsets.all(5),
child: Icon(
Expand Down
4 changes: 2 additions & 2 deletions lib/src/babs_component_simple_user_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
class SimpleUserCard extends StatelessWidget {
final ImageProvider userProfilePic;
final String userName;
final double? imageRadius;
final double imageRadius;
final Widget? userMoreInfo;
final VoidCallback? onTap;
final TextStyle? textStyle;
Expand Down Expand Up @@ -36,7 +36,7 @@ class SimpleUserCard extends StatelessWidget {
child: Stack(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(imageRadius!),
borderRadius: BorderRadius.circular(imageRadius),
child: Image(
image: userProfilePic,
fit: BoxFit.cover,
Expand Down
21 changes: 11 additions & 10 deletions lib/src/babs_component_small_user_card.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';

class SmallUserCard extends StatelessWidget {
final Color? cardColor;
final double? cardRadius;
final Color? backgroundMotifColor;
final VoidCallback? onTap;
final String? userName;
final Color cardColor;
final double cardRadius;
final Color backgroundMotifColor;
final VoidCallback onTap;
final String userName;
final Widget? userMoreInfo;
final ImageProvider userProfilePic;

Expand All @@ -30,23 +30,24 @@ class SmallUserCard extends StatelessWidget {
margin: EdgeInsets.only(bottom: 20),
decoration: BoxDecoration(
color: cardColor,
borderRadius:
BorderRadius.circular(double.parse(cardRadius!.toString())),
borderRadius: BorderRadius.circular(
double.parse(cardRadius.toString()),
),
),
child: Stack(
children: [
Align(
alignment: Alignment.bottomLeft,
child: CircleAvatar(
radius: 100,
backgroundColor: backgroundMotifColor!.withOpacity(.1),
backgroundColor: backgroundMotifColor.withOpacity(.1),
),
),
Align(
alignment: Alignment.center,
child: CircleAvatar(
radius: 400,
backgroundColor: backgroundMotifColor!.withOpacity(.05),
backgroundColor: backgroundMotifColor.withOpacity(.05),
),
),
Container(
Expand All @@ -71,7 +72,7 @@ class SmallUserCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
userName!,
userName,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 26,
Expand Down
21 changes: 9 additions & 12 deletions lib/src/icon_style.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import 'package:flutter/material.dart';

class IconStyle {
Color? iconsColor;
bool? withBackground;
Color? backgroundColor;
double? borderRadius;
final Color iconsColor;
final bool withBackground;
final Color backgroundColor;
final double borderRadius;

IconStyle({
iconsColor = Colors.white,
withBackground = true,
backgroundColor = Colors.blue,
borderRadius = 8,
}) : this.iconsColor = iconsColor,
this.withBackground = withBackground,
this.backgroundColor = backgroundColor,
this.borderRadius = double.parse(borderRadius!.toString());
this.iconsColor = Colors.white,
this.withBackground = true,
this.backgroundColor = Colors.blue,
this.borderRadius = 8,
});
}