-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
318 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; | ||
import 'package:infinite_horizons/presentation/atoms/atoms.dart'; | ||
import 'package:infinite_horizons/presentation/core/theme_data.dart'; | ||
|
||
/// Top part of the pages, will show page name and settings logo, | ||
/// and sometimes will have back button. | ||
class TopBarMolecule extends StatelessWidget { | ||
const TopBarMolecule({ | ||
required this.pageName, | ||
this.rightIcon, | ||
this.rightIconFunction, | ||
this.leftIcon, | ||
this.leftIconFunction, | ||
this.rightSecondIcon, | ||
this.rightSecondFunction, | ||
this.backgroundColor, | ||
}); | ||
|
||
/// Page name to show in the left side of the navigation bar | ||
final String? pageName; | ||
|
||
/// Icon to show in the right side of the bar | ||
final IconData? rightIcon; | ||
|
||
/// Icon to show in the right side of the bar left to the first icon | ||
/// from the right | ||
final IconData? rightSecondIcon; | ||
|
||
/// Icon to show in the left side of the bar | ||
final IconData? leftIcon; | ||
|
||
/// Function to execute when pressing the icon in the right side | ||
final Function(BuildContext)? rightIconFunction; | ||
|
||
/// What to execute if second right icon was pressed | ||
final Function(BuildContext)? rightSecondFunction; | ||
|
||
/// What to execute if back button was pressed | ||
final Function(BuildContext)? leftIconFunction; | ||
|
||
final Color? backgroundColor; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final ThemeData themeData = Theme.of(context); | ||
final ColorScheme colorScheme = themeData.colorScheme; | ||
final TextTheme textTheme = themeData.textTheme; | ||
|
||
final TextStyle style = textTheme.bodyLarge!; | ||
|
||
return SafeArea( | ||
child: ColoredBox( | ||
color: backgroundColor != null | ||
? backgroundColor!.withOpacity(0.72) | ||
: colorScheme.background, | ||
child: Container( | ||
margin: const EdgeInsets.fromLTRB( | ||
9, | ||
AppThemeData.generalSpacing, | ||
9, | ||
AppThemeData.generalSpacing, | ||
), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: <Widget>[ | ||
Row( | ||
children: <Widget>[ | ||
if (leftIcon != null) | ||
Container( | ||
alignment: Alignment.centerLeft, | ||
child: IconButton( | ||
icon: FaIcon( | ||
leftIcon, | ||
size: style.fontSize, | ||
color: colorScheme.tertiary, | ||
), | ||
onPressed: () => leftIconFunction!(context), | ||
), | ||
) | ||
else | ||
const SizedBox(), | ||
TextAtom( | ||
pageName!, | ||
style: style.copyWith(color: colorScheme.tertiary), | ||
), | ||
], | ||
), | ||
if (rightIcon != null) | ||
Row( | ||
children: [ | ||
if (rightSecondIcon != null) | ||
SizedBox( | ||
width: 70, | ||
child: TextButton( | ||
style: ButtonStyle( | ||
padding: MaterialStateProperty.all<EdgeInsets>( | ||
EdgeInsets.zero, | ||
), | ||
), | ||
onPressed: () => rightSecondFunction!(context), | ||
child: FaIcon( | ||
rightSecondIcon, | ||
size: style.fontSize, | ||
color: style.color, | ||
), | ||
), | ||
), | ||
SizedBox( | ||
width: 25, | ||
child: TextButton( | ||
style: ButtonStyle( | ||
padding: MaterialStateProperty.all<EdgeInsets>( | ||
EdgeInsets.zero, | ||
), | ||
), | ||
onPressed: () => rightIconFunction!(context), | ||
child: Icon( | ||
rightIcon, | ||
size: style.fontSize! + 5, | ||
color: style.color, | ||
), | ||
), | ||
), | ||
], | ||
) | ||
else | ||
const SizedBox(), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:infinite_horizons/domain/tip.dart'; | ||
import 'package:infinite_horizons/presentation/atoms/atoms.dart'; | ||
import 'package:infinite_horizons/presentation/organisms/organisms.dart'; | ||
import 'package:infinite_horizons/presentation/pages/tip_information.dart'; | ||
|
||
class AllTips extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: Column( | ||
children: [ | ||
TopBarMolecule( | ||
pageName: 'all_tips', | ||
leftIcon: Icons.arrow_back, | ||
leftIconFunction: (c) => Navigator.of(c).pop(), | ||
), | ||
ListView.separated( | ||
shrinkWrap: true, | ||
itemBuilder: (context, n) { | ||
final Tip tip = tipsList[n]; | ||
|
||
return UnconstrainedBox( | ||
child: ButtonAtom( | ||
variant: ButtonVariant.tertiary, | ||
onPressed: () => Navigator.of(context).push( | ||
MaterialPageRoute( | ||
builder: (context) => TipInformation(tip), | ||
), | ||
), | ||
text: tip.text, | ||
), | ||
); | ||
}, | ||
separatorBuilder: (context, i) => const SeparatorAtom(), | ||
itemCount: tipsList.length, | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} | ||
|
||
// ListView.separated( | ||
// shrinkWrap: true, | ||
// physics: const NeverScrollableScrollPhysics(), | ||
// scrollDirection: Axis.horizontal, | ||
// itemBuilder: (context, r) { | ||
// final Uri resource = tip.resourceLinks[r]; | ||
// | ||
// return ButtonAtom( | ||
// variant: ButtonVariant.tertiary, | ||
// onPressed: () => launchUrl(resource), | ||
// // TODO: Add to translation | ||
// text: 'Link $r', | ||
// ); | ||
// }, | ||
// separatorBuilder: (context, r) => const SeparatorAtom(), | ||
// itemCount: tip.resourceLinks.length, | ||
// ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.