Skip to content
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

Custom animated container, wide expansion panel, custom text field and info message panel widgets added. #32

Merged
merged 28 commits into from Oct 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c319137
Animated container example
mustafauys Sep 27, 2022
cf059cb
Item card widget file added.
mustafauys Sep 27, 2022
eb5b591
Custom large button widget added.
mustafauys Sep 27, 2022
c0f4a08
Color constant file updated.
mustafauys Sep 27, 2022
f2841b0
Context extension file added.
mustafauys Sep 27, 2022
88c12bb
Theme file updated.
mustafauys Sep 27, 2022
3c1e187
Wide expansion panel widget added.
mustafauys Sep 27, 2022
b785452
Wide expansion panel example added.
mustafauys Sep 27, 2022
55f799e
Wide expansion panel list added.
mustafauys Sep 27, 2022
6b4bcac
Theme file updated.
mustafauys Sep 27, 2022
9f94a8c
Wide expansion panel list updated.
mustafauys Sep 27, 2022
ee06dd5
Wide expansion panel example updated.
mustafauys Sep 27, 2022
ed96a3f
Wide expansion panel updated.
mustafauys Sep 27, 2022
b161819
GIF added.
mustafauys Sep 27, 2022
aad2532
GIF added.
mustafauys Sep 27, 2022
23d5f77
Theme file updated.
mustafauys Sep 29, 2022
9fb3f3b
Custom text field widget added.
mustafauys Sep 29, 2022
d85fbc2
Custom text field example added.
mustafauys Sep 29, 2022
4074a7d
Merge branch 'master' of https://github.com/mustafauys/flutter-ready-…
mustafauys Sep 29, 2022
40ea43a
İmages updated.
mustafauys Sep 29, 2022
3b2ef2f
Readme updated
mustafauys Sep 29, 2022
45e25aa
Theme updated.
mustafauys Sep 29, 2022
e6c5103
Colors updated.
mustafauys Sep 29, 2022
16c787b
GIF and image added.
mustafauys Sep 29, 2022
8e3e9d3
İnfo message panel widget and example added.
mustafauys Sep 29, 2022
8772c20
Merge branch 'master' of https://github.com/mustafauys/flutter-ready-…
mustafauys Sep 29, 2022
6c493dc
Readme updated.
mustafauys Sep 29, 2022
dad74fa
Merge branch 'master' into master
VB10 Oct 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 58 additions & 0 deletions README.md
Expand Up @@ -21,6 +21,32 @@

</table>

# Custom Animated Container

<table>
<tr>
<td>Custom Animated Container</td>
</tr>

<tr>
<td><img src="github/gifs/animatedContainer/animatedContainer.gif" width=270 height=480></td>
</tr>

</table>

# Wide Expansion Panel

<table>
<tr>
<td>Wide Expansion Panel</td>
</tr>

<tr>
<td><img src="github/gifs/wideExpansionPanel/wideExpansionPanel.gif" width=270 height=480></td>
</tr>

</table>

# Circular Progress

<table>
Expand Down Expand Up @@ -98,6 +124,38 @@

</table>

# Custom Text Field


<table>
<tr>
<td> Custom Text Field GIF</td>
<td> Custom Text Field PNG</td>
</tr>

<tr>
<td><img src="github/gifs/custom_text_field/custom_text_field.gif" width=270 height=480></td>
<td><img src="github/images/text_field/custom_text_field.png" width=270 height=480></td>
</tr>

</table>

# Info Message Panel


<table>
<tr>
<td>Info Message Panel GIF</td>
<td>Info Message Panel PNG</td>
</tr>

<tr>
<td><img src="github/gifs/info_message_panel/info_message_panel.gif" width=270 height=480></td>
<td><img src="github/images/info_message_panel/info_message_panel.png" width=270 height=480></td>
</tr>

</table>

# FacePile

<table>
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added github/images/text_field/custom_text_field.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions lib/atomic/custom_animated/example_animated.dart
@@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'package:ready_to_use_widgets/atomic/custom_animated/item_card_widget.dart';
import 'package:ready_to_use_widgets/core/init/constants/color_constant.dart';

class CustomAnimated extends StatefulWidget {
const CustomAnimated({Key? key}) : super(key: key);

@override
State<CustomAnimated> createState() => _CustomAnimatedState();
}

class _CustomAnimatedState extends State<CustomAnimated> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: ColorConstants.white,
appBar: AppBar(title: const Text('İşlerim')),
body: Column(
children: [
ItemCardWidget(
buttons: [
ItemCardButton(buttonText: 'İşi Tamamla', onPressed: () {}),
ItemCardButton(
buttonText: 'Detay',
isPrimary: false,
onPressed: () {},
backgroundColor: ColorConstants.steelGray),
],
cardLines: const [
CardLine(title: 'Title', value: 'Value', index: 0),
CardLine(title: 'Title', value: 'Value', index: 0),
CardLine(title: 'Title', value: 'Value', index: 0),
CardLine(title: 'Title', value: 'Value', index: 0),
CardLine(title: 'Title', value: 'Value', index: 0),
CardLine(title: 'Title', value: 'Value', index: 0),
CardLine(title: 'Title', value: 'Value', index: 0),
],
),
],
),
);
}
}
244 changes: 244 additions & 0 deletions lib/atomic/custom_animated/item_card_widget.dart
@@ -0,0 +1,244 @@
// ignore_for_file: must_be_immutable, library_private_types_in_public_api

import 'dart:math';
import 'package:flutter/material.dart';
import 'package:ready_to_use_widgets/atomic/large_button.dart/custom_large_button.dart';
import 'package:ready_to_use_widgets/core/init/constants/color_constant.dart';
import 'package:ready_to_use_widgets/core/init/extensions/context_extension.dart';


class ItemCardWidget extends StatefulWidget {
final int minShowItemCount;
final List<CardLine> cardLines;
final Duration animationDuration;
final Curve animationCurve = Curves.easeInOutCubic;
final List<ItemCardButton> buttons;
bool isExpanded;

ItemCardWidget(
{Key? key,
this.isExpanded = false,
this.minShowItemCount = 3,
required this.cardLines,
this.animationDuration = const Duration(milliseconds: 180),
required this.buttons})
: super(key: key);

@override
_ItemCardWidgetState createState() => _ItemCardWidgetState();
}

class _ItemCardWidgetState extends State<ItemCardWidget>
with SingleTickerProviderStateMixin {
late AnimationController _animationController;
late Animation _animation;

@override
void initState() {
super.initState();

_animationController = AnimationController(
vsync: this,
duration: widget.animationDuration,
lowerBound: 0,
upperBound: 180);
_animation = CurvedAnimation(
parent: _animationController,
curve: widget.animationCurve,
reverseCurve: widget.animationCurve);
}

@override
void dispose() {
_animationController.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10.0),
child: Material(
elevation: 4,
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: AnimatedBuilder(
animation: _animation,
builder: (context, child) => Container(
padding: const EdgeInsets.only(top: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
buildCardLines(),
Column(
children: [
buttonGroup(widget.buttons),
buildExpandButton(),
],
)
],
)),
)),
);
}

AnimatedCrossFade buildCardLines() {
return AnimatedCrossFade(
firstCurve: widget.animationCurve,
secondCurve: widget.animationCurve,
sizeCurve: widget.animationCurve,
firstChild: buildCardLinesColumn(),
secondChild: buildCardLinesColumn(),
crossFadeState: widget.isExpanded
? CrossFadeState.showSecond
: CrossFadeState.showFirst,
duration: widget.animationDuration);
}

AnimatedBuilder buildExpandButton() {
return AnimatedBuilder(
animation: _animation,
builder: (context, child) => ClipOval(
child: Material(
color: Colors.white,
child: InkWell(
onTap: () {
if (widget.isExpanded) {
_animationController.reverse();
widget.isExpanded = false;
} else {
_animationController.forward();
widget.isExpanded = true;
}
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Transform.rotate(
origin: const Offset(0.5, 0.5),
angle: _animationController.value * pi / 180,
child: const Icon(Icons.keyboard_arrow_down_outlined,
color: Colors.black),
),
),
),
),
),
);
}

Column buildCardLinesColumn() {
return Column(
mainAxisSize: MainAxisSize.min,
children: widget.isExpanded
? widget.cardLines
: widget.cardLines.sublist(
0,
(widget.minShowItemCount < widget.cardLines.length
? widget.minShowItemCount
: widget.cardLines.length)),
);
}

Widget buttonGroup(List<ItemCardButton> buttons) {
List<Widget> widgetList = [];
buttons.forEach((element) {
widgetList.add(
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: element,
)),
);
});

return Container(
padding: const EdgeInsets.only(
top: 4,
left: 16,
right: 16,
),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: widgetList),
);
}
}

class ItemCardButton extends StatelessWidget {
final Color? backgroundColor;
final bool isPrimary;
final String? buttonText;
final VoidCallback? onPressed;

const ItemCardButton({
Key? key,
this.isPrimary = true,
this.buttonText,
this.onPressed,
this.backgroundColor,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return LargeButton(
text: buttonText.toString(),
style: context.appTheme().itemCardWidgetTextStyle,
backgroundColor: isPrimary ? ColorConstants.blueGray : backgroundColor,
isOutlined: true,
onPressed: onPressed,
);
}
}

class CardLine extends StatelessWidget {
const CardLine({
Key? key,
required this.title,
required this.value,
required this.index,
}) : super(key: key);

final String title;
final String value;
final int index;

final _listBottomLeftTextStyle = const TextStyle(
fontWeight: FontWeight.bold, fontSize: 14, color: Colors.black);
final _listBottomRightTextStyle =
const TextStyle(fontSize: 14, color: Colors.black);

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.only(
top: 4,
left: 16,
right: 16,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: _listBottomLeftTextStyle,
),
SizedBox(
// width: MediaQuery.of(context).size.width*0.4,
child: Text(
value,
style: _listBottomRightTextStyle,
textAlign: TextAlign.right,
),
)
],
),
);
}
}