Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
VB10 committed Oct 2, 2022
2 parents 6c493dc + 535658f commit dad74fa
Show file tree
Hide file tree
Showing 23 changed files with 747 additions and 83 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"workbench.colorCustomizations": {
"titleBar.activeBackground": "#21481E",
"titleBar.activeForeground": "#F7FBF7"
}
},
"cmake.sourceDirectory": "${workspaceFolder}/windows"
}
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,42 @@
| Name | Readme |
| ------------------------ | --------------------------------------------------------------------------------------------------------- |
| Bottom List Picker | [Readme](lib/feature/bottomlistpicker/readme.md) |
[Gif](github/gifs/bottomlistpicker/bottom_list_picker.gif)
[Gif](github/gifs/bottomlistpicker/bottom_list_picker.gif)
| Bottom List Picker | [Readme](github/gifs/bottomlistpicker/bottom_list_picker.gif) |


# Circle Avatar Image And Alphabet



<table>
<tr>
<td> Circle Avatar Image And Alphabet </td>
</tr>

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

</table>
[Readme](lib/feature/circle_avatar_image_and_alphabet/readme.md)




# Rating Bar


<table>
<tr>
<td> Heart Icon Bar </td>
<td> Star Icon Bar </td>
</tr>

<tr>
<td><img src="github/gifs/rating_bar/heart_icon.gif" width=270 height=480></td>
<td><img src="github/gifs/rating_bar/star_icon.gif" width=270 height=480></td>
# Stacked Images Widget

<table>
Expand Down
5 changes: 5 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
Expand Down
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/gifs/rating_bar/heart_icon.gif
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/gifs/rating_bar/star_icon.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions lib/atomic/datetime/hour_selector/hour_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import 'package:flutter/material.dart';
import '../../../feature/dropdown/searchable_dropdown_with_paginated_request/searchable_dropdown_with_paginated_request.dart';

extension CustomTimeOfDayExtension on TimeOfDay {
Duration substract(TimeOfDay timeOfDay) =>
Duration(hours: hour, minutes: minute) - Duration(hours: timeOfDay.hour, minutes: timeOfDay.minute);
Duration substract(TimeOfDay timeOfDay) => Duration(hours: hour, minutes: minute) - Duration(hours: timeOfDay.hour, minutes: timeOfDay.minute);

TimeOfDay addMinutes(int minutes) {
if (minutes == 0) return this;
Expand All @@ -19,6 +18,7 @@ extension CustomTimeOfDayExtension on TimeOfDay {
String toStringFormat() => (hour < 10 ? '0' : '') + '$hour:' + (minute < 10 ? '0' : '') + '$minute';
}

// ignore: todo
//TODO bu widgeta disabled hours özelliği de kazandırılabilir. Verilen saatler kırmızı gelir ve seçilemez.

// ignore: must_be_immutable
Expand Down Expand Up @@ -160,8 +160,7 @@ class SelectableHourWidget extends StatelessWidget {
final TimeOfDay time;
final SelectableHourStatus selectableHourStatus;
final Function(TimeOfDay time) onTap;
const SelectableHourWidget({Key? key, required this.time, required this.selectableHourStatus, required this.onTap})
: super(key: key);
const SelectableHourWidget({Key? key, required this.time, required this.selectableHourStatus, required this.onTap}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'package:flutter/material.dart';

enum RatingBarIcon { star, heart }

extension RatingBarIconExtension on RatingBarIcon {
Icon get icon => Icon(index == 0 ? Icons.star : Icons.favorite);
}
64 changes: 64 additions & 0 deletions lib/atomic/rating_bar/rating_bar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import 'package:flutter/material.dart';
import 'package:ready_to_use_widgets/atomic/rating_bar/extension/rating_bar_icon_extension.dart';

class RatingBar extends StatefulWidget {
const RatingBar({
Key? key,
required this.onPressed,
this.ratingBarIcon = RatingBarIcon.star,
this.iconSize = 70.0,
this.initialValue = 1,
this.direction = Axis.horizontal,
this.progressColor = const Color(0xFFFFBF00),
this.backgroundColor = const Color(0xFFC5C5C5),
}) : assert(initialValue >= 0 && initialValue <= 5),
super(key: key);

final void Function(int index) onPressed;
final RatingBarIcon ratingBarIcon;
final int initialValue;
final Color progressColor;
final Axis direction;
final double iconSize;
final Color backgroundColor;

@override
State<RatingBar> createState() => _RatingBarState();
}

class _RatingBarState extends State<RatingBar> {
final int size = 5;
late ValueNotifier<int> selectedRate;

@override
void initState() {
selectedRate = ValueNotifier(widget.initialValue);
super.initState();
}

@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: size,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
scrollDirection: widget.direction,
itemBuilder: (context, index) => ValueListenableBuilder(
valueListenable: selectedRate,
builder: (_, __, ___) => _iconButton(index),
),
);
}

IconButton _iconButton(int index) => IconButton(
icon: widget.ratingBarIcon.icon,
iconSize: widget.iconSize,
onPressed: () {
selectedRate.value = index + 1;
widget.onPressed.call(selectedRate.value);
},
color: index + 1 <= selectedRate.value
? widget.progressColor
: widget.backgroundColor,
);
}
17 changes: 9 additions & 8 deletions lib/feature/bottomlistpicker/example/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ class User extends INetworkModel {
website = json['website'];
}

@override
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['username'] = this.username;
data['email'] = this.email;

data['phone'] = this.phone;
data['website'] = this.website;
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['name'] = name;
data['username'] = username;
data['email'] = email;

data['phone'] = phone;
data['website'] = website;

return data;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import 'dart:io';

import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';

import 'package:kartal/kartal.dart';

class CircleAvatarImageAndAlphabet extends StatelessWidget {
final Function()? onTap;
final String? imagePath;
final String? text;
final int? color;
final bool isFullText;
final double radius;

const CircleAvatarImageAndAlphabet({Key? key, this.onTap, required this.radius, this.text, this.imagePath, this.color, this.isFullText = false})
: super(key: key);

@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
CircleAvatar(
backgroundImage: imagePath == null ? null : FileImage(File(imagePath!)),
radius: radius,
child: imagePath == null
? Padding(
padding: context.paddingLow,
child: AutoSizeText(
text != null ? getTextFirsCharter(text!) : " ",
style: Theme.of(context).textTheme.headline3,
textAlign: TextAlign.center,
maxLines: 2,
),
)
: null,
backgroundColor: color != null ? Color(color!) : null),
]),
);
}

String getTextFirsCharter(String text) {
String value = "";
var splitTextList = text.split(" ");

if (isFullText) {
return text.toUpperCase();
} else {
for (var element in splitTextList) {
if (element.isNotNullOrNoEmpty) {
value = value + element[0];
}
}

return value.toUpperCase();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:ready_to_use_widgets/feature/circle_avatar_image_and_alphabet/circle_avatar_image_and_alphabet.dart';
import 'package:kartal/kartal.dart';
import '../../../atomic/text_field/custom_text_field.dart';
import 'circle_avatar_image_and_alphabet_example_view_model.dart';

class CircleAvatarImageAndAlphabetExampleView extends StatelessWidget {
const CircleAvatarImageAndAlphabetExampleView({Key? key, required this.viewModel}) : super(key: key);

final CircleAvatarImageAndAlphabetExampleViewModel viewModel;
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (context) => viewModel,
builder: (context, child) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text("Circle Avatar Image And Alphabet"),
),
body: SingleChildScrollView(
child: Padding(
padding: context.paddingMedium,
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () {
viewModel.getImage(false);
},
icon: const Icon(Icons.add_a_photo_outlined)),
Consumer<CircleAvatarImageAndAlphabetExampleViewModel>(
builder: (context, value, child) {
return CircleAvatarImageAndAlphabet(
color: viewModel.color,
imagePath: viewModel.image == null ? null : viewModel.image!.path,
radius: context.width * 0.2,
text: viewModel.controllerAdi.text + " " + viewModel.controllerSoyadi.text,
onTap: () {
viewModel.selectedColor(context);
},
);
},
),
IconButton(
onPressed: () {
viewModel.getImage(true);
},
icon: const Icon(Icons.file_upload))
],
),
Padding(
padding: context.verticalPaddingLow,
child: CustomTextField(
controller: viewModel.controllerAdi,
labelText: "Adı",
)),
Padding(
padding: context.verticalPaddingLow,
child: CustomTextField(
controller: viewModel.controllerSoyadi,
labelText: "Soyadi",
)),
],
),
),
),
),
);
},
);
}
}

0 comments on commit dad74fa

Please sign in to comment.