Skip to content

Commit

Permalink
Merge branch 'release/0.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vitoramaral10 committed Sep 6, 2023
2 parents f6381dc + acb3b1f commit f5c57f5
Show file tree
Hide file tree
Showing 8 changed files with 907 additions and 228 deletions.
236 changes: 68 additions & 168 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions example/lib/config/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart';
import '../pages/about/license_page.dart';
import '../pages/components/alerts_page.dart';
import '../pages/components/buttons_page.dart';
import '../pages/components/modal_page.dart';
import '../pages/content/typography_page.dart';
import '../pages/customize/customize_color_page.dart';
import '../pages/example/sign_in_page.dart';
Expand All @@ -18,6 +19,7 @@ class Routes {
'/about/license': (final context) => const LicensePage(),
'/components/alerts': (final context) => const AlertsPage(),
'/components/buttons': (final context) => const ButtonsPage(),
'/components/modal': (final context) => const ModalPage(),
'/content/typography': (final context) => const TypographyPage(),
'/customize/color': (final context) => const CustomizeColorPage(),
'/examples/sign_in': (final context) => const SignInPage(),
Expand Down
607 changes: 607 additions & 0 deletions example/lib/pages/components/modal_page.dart

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions example/lib/pages/widgets/footer_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ class FooterWidget extends StatelessWidget {
height: 42,
color: BTColors.black,
),
Text('Bootstrap',
style: GetBootstrap.typography.headline5,),
Text(
'Bootstrap',
style: GetBootstrap.typography.headline5,
),
],
),
Padding(
Expand Down
79 changes: 78 additions & 1 deletion example/lib/pages/widgets/sidebar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,84 @@ class Sidebar extends StatelessWidget {
style: GetBootstrap.typography.small,
),
Text(
'Figures',
'Button group',
style: GetBootstrap.typography.small,
),
Text(
'Card',
style: GetBootstrap.typography.small,
),
Text(
'Carousel',
style: GetBootstrap.typography.small,
),
Text(
'Close button',
style: GetBootstrap.typography.small,
),
Text(
'Collapse',
style: GetBootstrap.typography.small,
),
Text(
'Dropdowns',
style: GetBootstrap.typography.small,
),
Text(
'List group',
style: GetBootstrap.typography.small,
),
InkWell(
onTap: () async {
await Navigator.pushNamed(context, '/components/modal');
},
child: Text(
'Modal',
style: GetBootstrap.typography.small,
),
),
Text(
'Navbar',
style: GetBootstrap.typography.small,
),
Text(
'Navs & tabs',
style: GetBootstrap.typography.small,
),
Text(
'Offcanvas',
style: GetBootstrap.typography.small,
),
Text(
'Pagination',
style: GetBootstrap.typography.small,
),
Text(
'Placeholders',
style: GetBootstrap.typography.small,
),
Text(
'Popovers',
style: GetBootstrap.typography.small,
),
Text(
'Progress',
style: GetBootstrap.typography.small,
),
Text(
'Scrollspy',
style: GetBootstrap.typography.small,
),
Text(
'Spinners',
style: GetBootstrap.typography.small,
),
Text(
'Toasts',
style: GetBootstrap.typography.small,
),
Text(
'Tooltips',
style: GetBootstrap.typography.small,
),
],
Expand Down
158 changes: 111 additions & 47 deletions lib/components/modals/bt_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class BTModal extends StatelessWidget {
final Alignment? alignment;
final Size? size;
final bool fullScreen;
final double elevation;
final Size? fullScreenSize;
final Color? headBackground;
final Color? bodyBackground;
Expand All @@ -24,13 +25,57 @@ class BTModal extends StatelessWidget {
final Widget? body;
final Widget? footer;

double _getMaxWidth(final BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
final isXxl = fullScreenSize == Size.xxl && screenWidth < 1400;
final isXl = fullScreenSize == Size.xl && screenWidth < 1200;
final isLg = fullScreenSize == Size.lg && screenWidth < 992;
final isMd = fullScreenSize == Size.md && screenWidth < 768;
final isSm = fullScreenSize == Size.sm && screenWidth < 576;

if (fullScreen && (isXxl || isXl || isLg || isMd || isSm)) {
return screenWidth;
}

if (screenWidth >= 1200) {
if (size case Size.sm) {
return 300;
} else if (size case Size.lg) {
return 800;
} else if (size case Size.xl) {
return 1140;
} else {
return 500;
}
} else if (screenWidth >= 992) {
if (size case Size.sm) {
return 300;
} else if (size case Size.lg) {
return 800;
} else if (size case Size.xl) {
return 800;
} else {
return 500;
}
} else if (screenWidth >= 576) {
if (size == Size.sm) {
return 300;
} else {
return 500;
}
} else {
return screenWidth;
}
}

BTModal({
required this.body,
super.key,
this.alignment = Alignment.topCenter,
this.size,
this.fullScreen = false,
this.fullScreenSize,
this.elevation = 6.0,
this.head,
this.footer,
this.headBackground,
Expand All @@ -45,36 +90,9 @@ class BTModal extends StatelessWidget {
'O parâmetro "size" somente pode ser utilizado com os '
'tamanhos: sm, lg, xl, xxl');

double _getWidth(final BuildContext context) {
final double width = MediaQuery.of(context).size.width;

if (width >= 1200) {
if (size == Size.sm) {
return 300;
} else if (size == Size.lg) {
return 800;
} else if (size == Size.xl) {
return 1140;
} else {
return 500;
}
} else if (width >= 992) {
if (size == Size.sm) {
return 300;
} else if (size == Size.lg || size == Size.xl) {
return 800;
} else {
return 500;
}
} else if (width >= 576) {
return size == Size.sm ? 300 : 500;
} else {
return width;
}
}

@override
Widget build(final BuildContext context) => Dialog(
elevation: elevation,
insetPadding: (fullScreen && fullScreenSize == null) ||
(fullScreen &&
fullScreenSize == Size.xxl &&
Expand Down Expand Up @@ -107,24 +125,7 @@ class BTModal extends StatelessWidget {
alignment: alignment,
child: Container(
constraints: BoxConstraints(
maxWidth: (fullScreen && fullScreenSize == null) ||
(fullScreen &&
fullScreenSize == Size.xxl &&
MediaQuery.of(context).size.width < 1400) ||
(fullScreen &&
fullScreenSize == Size.xl &&
MediaQuery.of(context).size.width < 1200) ||
(fullScreen &&
fullScreenSize == Size.lg &&
MediaQuery.of(context).size.width < 992) ||
(fullScreen &&
fullScreenSize == Size.md &&
MediaQuery.of(context).size.width < 768) ||
(fullScreen &&
fullScreenSize == Size.sm &&
MediaQuery.of(context).size.width < 576)
? MediaQuery.of(context).size.width
: _getWidth(context),
maxWidth: _getMaxWidth(context),
minHeight: (fullScreen && fullScreenSize == null) ||
(fullScreen &&
fullScreenSize == Size.xxl &&
Expand Down Expand Up @@ -166,7 +167,11 @@ class BTModal extends StatelessWidget {
),
),
width: double.infinity,
child: head,
child: Material(
color: Colors.transparent,
textStyle: BTTypography().headline5,
child: head,
),
),
if (head != null && (body != null || footer != null))
Divider(
Expand Down Expand Up @@ -227,6 +232,65 @@ class BTModal extends StatelessWidget {
width: double.infinity,
child: body,
),
if (head != null && (body != null || footer != null))
Divider(
height: 1,
color: darkMode ? BTColors.gray600 : BTColors.gray300,
),
if (body != null)
(fullScreen && size == null) || (fullScreen && size == Size.xxl)
? Expanded(
child: SingleChildScrollView(
child: Container(
padding: bodyPadding ?? const EdgeInsets.all(16),
decoration: BoxDecoration(
color: bodyBackground ??
(darkMode
? BTColors.gray800
: BTColors.white),
borderRadius: BorderRadius.only(
topLeft: head == null
? const Radius.circular(8)
: Radius.zero,
topRight: head == null
? const Radius.circular(8)
: Radius.zero,
bottomLeft: footer == null
? const Radius.circular(8)
: Radius.zero,
bottomRight: footer == null
? const Radius.circular(8)
: Radius.zero,
),
),
width: double.infinity,
child: body,
),
),
)
: Container(
padding: bodyPadding ?? const EdgeInsets.all(16),
decoration: BoxDecoration(
color: bodyBackground ??
(darkMode ? BTColors.gray800 : BTColors.white),
borderRadius: BorderRadius.only(
topLeft: head == null
? const Radius.circular(8)
: Radius.zero,
topRight: head == null
? const Radius.circular(8)
: Radius.zero,
bottomLeft: footer == null
? const Radius.circular(8)
: Radius.zero,
bottomRight: footer == null
? const Radius.circular(8)
: Radius.zero,
),
),
width: double.infinity,
child: body,
),
if (footer != null)
Divider(
height: 1,
Expand Down
45 changes: 36 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,41 @@
{
"version": "0.13.0",
"scripts": {
"changelog": "auto-changelog"
},
"auto-changelog": {
"commitLimit": false,
"unreleased": true,
"replaceText": {
"[Ff]eat:": "",
"[Ff]ix:": "",
"[Bb]reak:": ""
},
"includeBranch": [
"develop",
"main"
],
"template": "https://gist.githubusercontent.com/vitoramaral10/b41af8d90c03f7d527ad9944f617131f/raw/3ad8e04ec811ad7f1549c2a49ceefb7d18f81ed7/changelog-template.hbs",
"hideEmptyReleases": true,
"package": true
},
"devDependencies": {
"cz-conventional-changelog": "^3.3.0"
"auto-changelog": "^2.4.0"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
"name": "get_bootstrap",
"description": "Clone do Bootstrap para o flutter.",
"repository": {
"type": "git",
"url": "git+https://github.com/vitoramaral10/get_bootstrap.git"
},
"scripts": {
"release": "standard-version"
"keywords": [
"Bootstrap",
"Flutter"
],
"author": "Vitor Amaral de Melo",
"license": "MIT",
"bugs": {
"url": "https://github.com/vitoramaral10/get_bootstrap/issues"
},
"version": "0.12.2"
}
"homepage": "https://github.com/vitoramaral10/get_bootstrap#readme"
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: get_bootstrap
description: Este projeto foi desenvolvido com base a documentação do Bootstrap,
porém foi desenvolvido a mão para uso no Flutter.
version: 0.12.2
version: 0.13.0
homepage: https://github.com/vitoramaral10/get_bootstrap

environment:
Expand Down

0 comments on commit f5c57f5

Please sign in to comment.