-
Notifications
You must be signed in to change notification settings - Fork 4
Enhancement/gh 61/choose templetes #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Changes from all commits
25b14b7
cbf8e86
b0a0a94
7e6755b
d8eee94
7c96c94
9086ff6
6f25f46
8eba2fe
cf0a471
2b0360e
fe5f757
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import 'package:collaction_cms/presentation/crowdactions/crowdaction_form/sections/commitments_section/assign_commitments/commitment_template/commitment_template_widgets/commitment_list_pages.dart'; | ||
| import 'package:collaction_cms/presentation/crowdactions/crowdaction_form/sections/commitments_section/assign_commitments/commitment_template/commitment_template_widgets/tag_search.dart'; | ||
| import 'package:collaction_cms/presentation/theme/constants.dart'; | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| class CommitmentTemplate extends StatefulWidget { | ||
| final double fullWidth; | ||
| const CommitmentTemplate({super.key, required this.fullWidth}); | ||
|
|
||
| @override | ||
| State<CommitmentTemplate> createState() => _CommitmentTemplateState(); | ||
| } | ||
|
|
||
| class _CommitmentTemplateState extends State<CommitmentTemplate> { | ||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Padding( | ||
| padding: const EdgeInsets.all(18.0), | ||
| child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ | ||
| const Padding( | ||
| padding: EdgeInsets.only(bottom: 5.0), | ||
| child: TagSearchSection(), | ||
| ), | ||
| const Divider( | ||
| color: kCommitmentDividerColor, | ||
| thickness: 1, | ||
| ), | ||
| CommitmentListPages(fullWidth: widget.fullWidth), | ||
| ]), | ||
| ); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| import 'package:collaction_cms/presentation/crowdactions/crowdaction_form/sections/commitments_section/assign_commitments/commitment_template/commitment_template_widgets/dummy_data.dart'; | ||
| import 'package:collaction_cms/presentation/crowdactions/crowdaction_form/sections/commitments_section/assign_commitments/commitment_template/commitment_template_widgets/expandable_card_list.dart'; | ||
| import 'package:collaction_cms/presentation/crowdactions/crowdaction_form/sections/commitments_section/assign_commitments/commitment_template/commitment_template_widgets/previousNextButton.dart'; | ||
| import 'package:collaction_cms/presentation/shared/extra/list_counter.dart'; | ||
| import 'package:collection/collection.dart'; | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| import '../../../../../../../theme/constants.dart'; | ||
|
|
||
| class CommitmentListPages extends StatefulWidget { | ||
| final double fullWidth; | ||
| const CommitmentListPages({super.key, required this.fullWidth}); | ||
|
|
||
| @override | ||
| State<CommitmentListPages> createState() => _CommitmentListPagesState(); | ||
| } | ||
|
|
||
| class _CommitmentListPagesState extends State<CommitmentListPages> { | ||
| final PageController controller = PageController(); | ||
| int _currentPage = 0; | ||
| List<Widget> pages = []; | ||
| static const _kDuration = Duration(milliseconds: 300); | ||
| static const _kCurve = Curves.ease; | ||
|
|
||
| @override | ||
| void dispose() { | ||
| controller.dispose(); | ||
| super.dispose(); | ||
| } | ||
|
|
||
| @override | ||
| void initState() { | ||
| buildPages(dummyData); | ||
| super.initState(); | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Column( | ||
| children: [ | ||
| Container( | ||
| margin: const EdgeInsets.only(top: 10), | ||
| child: Row( | ||
| children: [ | ||
| const SelectableText( | ||
| "Commitments", | ||
| style: CollactionTextStyles.captionStyleBold, | ||
| ), | ||
| Center( | ||
| child: Counter( | ||
| counter: dummyData.length.toString(), | ||
| height: 15, | ||
| width: 15, | ||
| textStyle: | ||
| CollactionTextStyles.captionStyle.copyWith(height: 0), | ||
| )), | ||
| const Spacer(), | ||
| PreviousNextbutton( | ||
| buttonText: 'Previous', | ||
| buttonAction: () => controller.previousPage( | ||
| duration: _kDuration, curve: _kCurve), | ||
| ), | ||
| SelectableText( | ||
| "Page ${_currentPage + 1} of ${pages.length.toString()}", | ||
| style: | ||
| CollactionTextStyles.captionStyleLight.copyWith(height: -1), | ||
| ), | ||
| PreviousNextbutton( | ||
| buttonText: 'Next', | ||
| buttonAction: () => | ||
| controller.nextPage(duration: _kDuration, curve: _kCurve), | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| SizedBox(height: widget.fullWidth - 100, child: buildPages(dummyData)), | ||
| ], | ||
| ); | ||
| } | ||
|
|
||
| Widget buildPages(List itemsList) { | ||
| pages.clear(); | ||
| List<List> itemLists = itemsList.slices(4).toList(); | ||
| for (var i = 0; i < itemLists.length; i++) { | ||
| ExpandableCardList item = ExpandableCardList( | ||
| itemList: itemLists[i], | ||
| height: widget.fullWidth - 100, | ||
| ); | ||
| pages.add(item); | ||
| } | ||
| return PageView.builder( | ||
| controller: controller, | ||
| itemCount: pages.length, | ||
| itemBuilder: (BuildContext context, int index) { | ||
| return pages[index % pages.length]; | ||
| }, | ||
| onPageChanged: (page) => setState(() { | ||
| _currentPage = page; | ||
| }), | ||
| ); | ||
| } | ||
| } |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already have the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dromerolovo I need to ask to get it better, should I implement an expandable card widget as a third item type in the enum and add it under or a generic child type in the enum and then pass expandable card as a type of CommitmentItem where I use? Thank you so much for your attention and time. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| import 'package:collaction_cms/presentation/shared/buttons/button_outlined.dart'; | ||
| import 'package:flutter/material.dart'; | ||
| import '../../../../../../../theme/constants.dart'; | ||
|
|
||
| class ExpandableTemplateCard extends StatefulWidget { | ||
| final String label; | ||
| final IconData icons; | ||
| final List<String> tags; | ||
| final String description; | ||
| final String points; | ||
|
|
||
| const ExpandableTemplateCard( | ||
| {super.key, | ||
| required this.label, | ||
| required this.icons, | ||
| required this.tags, | ||
| required this.description, | ||
| required this.points}); | ||
|
|
||
| @override | ||
| State<ExpandableTemplateCard> createState() => _ExpandableTemplateCardState(); | ||
| } | ||
|
|
||
| class _ExpandableTemplateCardState extends State<ExpandableTemplateCard> { | ||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Padding( | ||
| padding: const EdgeInsets.only( | ||
| top: 5, | ||
| bottom: 5, | ||
| ), | ||
| child: ExpansionTile( | ||
| backgroundColor: kScaffoldColorWhite, | ||
| collapsedBackgroundColor: kScaffoldColorWhite, | ||
| shape: RoundedRectangleBorder( | ||
| borderRadius: BorderRadius.circular(10.0), | ||
| side: const BorderSide( | ||
| color: kBlackPrimary100, | ||
| ), | ||
| ), | ||
| collapsedShape: RoundedRectangleBorder( | ||
| borderRadius: BorderRadius.circular(10.0), | ||
| side: const BorderSide( | ||
| color: kBlackPrimary100, | ||
| ), | ||
| ), | ||
| iconColor: kBlackPrimary300, | ||
| title: Row( | ||
CaglarKullu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| children: [ | ||
| Padding( | ||
| padding: const EdgeInsets.only(right: 10.0, top: 5, bottom: 5), | ||
| child: Container( | ||
| alignment: Alignment.center, | ||
| decoration: BoxDecoration( | ||
| color: kBlackPrimary0, | ||
| borderRadius: BorderRadius.circular(30), | ||
| ), | ||
| child: Padding( | ||
| padding: const EdgeInsets.all(8.0), | ||
| child: Icon( | ||
| widget.icons, | ||
| color: kAccentColor, | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| SelectableText( | ||
| widget.label, | ||
| style: CollactionTextStyles.bodyLabelRegular, | ||
| ), | ||
| const Spacer(), | ||
| const SmallOutlinedButton( | ||
| smallOutlinedButtonType: SmallOutlinedButtonType.add, | ||
| callback: null, | ||
| ) | ||
| ], | ||
| ), | ||
| children: [ | ||
| ListTile( | ||
| title: Column( | ||
| crossAxisAlignment: CrossAxisAlignment.start, | ||
| children: [ | ||
| const Divider( | ||
| color: kCommitmentDividerColor, | ||
| thickness: 1, | ||
| height: 8, | ||
| ), | ||
| Padding( | ||
| padding: const EdgeInsets.only(top: 5.0, bottom: 5, left: 15), | ||
| child: Column( | ||
| crossAxisAlignment: CrossAxisAlignment.start, | ||
| children: [ | ||
| SelectableText.rich(TextSpan( | ||
| text: "Tags: ", | ||
| style: CollactionTextStyles.bodySemiBold.copyWith( | ||
| fontSize: 14, | ||
| fontWeight: FontWeight.w500, | ||
| color: const Color(0xFF707070)), | ||
| children: [ | ||
| TextSpan( | ||
| text: widget.tags.toString(), | ||
| style: CollactionTextStyles.body14, | ||
| ) | ||
| ])), | ||
| const SizedBox(height: 5), | ||
| SelectableText.rich(TextSpan( | ||
| text: "Description: ", | ||
| style: CollactionTextStyles.bodySemiBold.copyWith( | ||
| fontSize: 14, | ||
| fontWeight: FontWeight.w500, | ||
| color: const Color(0xFF707070)), | ||
| children: [ | ||
| TextSpan( | ||
| text: widget.description, | ||
| style: CollactionTextStyles.body14, | ||
| ) | ||
| ])), | ||
| const SizedBox(height: 5), | ||
| SelectableText.rich(TextSpan( | ||
| text: "Points: ", | ||
| style: CollactionTextStyles.bodySemiBold.copyWith( | ||
| fontSize: 14, | ||
| fontWeight: FontWeight.w500, | ||
| color: const Color(0xFF707070)), | ||
| children: [ | ||
| TextSpan( | ||
| text: widget.points, | ||
| style: CollactionTextStyles.body14, | ||
| ) | ||
| ])), | ||
| const SizedBox(height: 5), | ||
| ], | ||
| ), | ||
| ) | ||
| ], | ||
| ), | ||
| ) | ||
| ], | ||
| ), | ||
| ); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import 'package:collaction_cms/presentation/core/icons/collaction_icons.dart'; | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| class DummyModel { | ||
| final String label; | ||
| final List<String> tags; | ||
| final String description; | ||
| final String points; | ||
| final IconData commitmentIcon; | ||
|
|
||
| DummyModel(this.label, this.tags, this.description, this.points, | ||
| this.commitmentIcon); | ||
| } | ||
|
|
||
| List<DummyModel> dummyData = <DummyModel>[ | ||
| DummyModel( | ||
| "1 days per week", | ||
| ["Days", "Veganuary", "Diet"], | ||
| "Commit to eating a vegan diet 4 day per week", | ||
| "10", | ||
| CollactionIcons.vegan), | ||
| DummyModel( | ||
| "2 days per week", | ||
| ["Days", "Veganuary", "Diet"], | ||
| "Commit to eating a vegan diet 4 day per week", | ||
| "20", | ||
| CollactionIcons.vegan), | ||
| DummyModel( | ||
| "3 days per week", | ||
| ["Days", "Veganuary", "Diet"], | ||
| "Commit to eating a vegan diet 4 day per week", | ||
| "30", | ||
| CollactionIcons.vegan), | ||
| DummyModel( | ||
| "4 days per week", | ||
| ["Days", "Veganuary", "Diet"], | ||
| "Commit to eating a vegan diet 4 day per week", | ||
| "40", | ||
| CollactionIcons.vegan), | ||
| DummyModel( | ||
| "5 days per week", | ||
| ["Days", "Veganuary", "Diet"], | ||
| "Commit to eating a vegan diet 4 day per week", | ||
| "50", | ||
| CollactionIcons.vegan), | ||
| ]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| import 'commitment_template_expandablecard.dart'; | ||
|
|
||
| class ExpandableCardList extends StatelessWidget { | ||
| final double height; | ||
| final List itemList; | ||
|
|
||
| const ExpandableCardList( | ||
| {super.key, required this.height, required this.itemList}); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Padding( | ||
| padding: const EdgeInsets.only( | ||
| top: 16, | ||
| ), | ||
| child: SizedBox( | ||
| height: height, | ||
| child: SingleChildScrollView( | ||
| child: ListView.builder( | ||
| itemCount: itemList.length, | ||
| shrinkWrap: true, | ||
| itemBuilder: (BuildContext context, int index) { | ||
| return ExpandableTemplateCard( | ||
| label: itemList[index].label, | ||
| icons: itemList[index].commitmentIcon, | ||
| tags: itemList[index].tags, | ||
| description: itemList[index].description, | ||
| points: itemList[index].points); | ||
| }, | ||
| ), | ||
| ), | ||
| ), | ||
| ); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.