Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 93a9b7b

Browse files
author
xuyingjun
committed
v1.0.17 Initial value option added Radio List Dialog.
1 parent f7c9dee commit 93a9b7b

File tree

9 files changed

+35
-36
lines changed

9 files changed

+35
-36
lines changed

‎CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,8 @@
6565

6666
## 1.0.16
6767

68+
* add decoration property
69+
70+
## 1.0.17
71+
6872
* add decoration property

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Global dialog function encapsulation, with a semantic way to fill the content in
1717

1818
```yaml
1919
dependencies:
20-
flutter_custom_dialog: ^1.0.16
20+
flutter_custom_dialog: ^1.0.17
2121
```
2222
2323
**2、import**

‎README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
```yaml
1717
dependencies:
18-
flutter_custom_dialog: ^1.0.16
18+
flutter_custom_dialog: ^1.0.17
1919
```
2020
2121
**2、import**

‎example/lib/dialog/listview_dialog.dart

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,63 +63,54 @@ var radioItems = [
6363
RadioItem(
6464
padding: EdgeInsets.only(left: 6.0),
6565
text: "None",
66-
value: 1,
6766
color: Colors.black,
6867
fontSize: 16.0,
6968
),
7069
RadioItem(
7170
padding: EdgeInsets.only(left: 6.0),
7271
text: "Callisto",
73-
value: 11,
7472
color: Colors.black,
7573
fontSize: 16.0,
7674
),
7775
RadioItem(
7876
padding: EdgeInsets.only(left: 6.0),
7977
text: "Ganymede",
80-
value: 7,
8178
color: Colors.black,
8279
fontSize: 16.0,
8380
),
8481
RadioItem(
8582
padding: EdgeInsets.only(left: 6.0),
8683
text: "Luna",
87-
value: 6,
8884
color: Colors.black,
8985
fontSize: 16.0,
9086
),
9187
RadioItem(
9288
padding: EdgeInsets.only(left: 6.0),
9389
text: "Oberon",
94-
value: 4,
9590
color: Colors.black,
9691
fontSize: 16.0,
9792
),
9893
RadioItem(
9994
padding: EdgeInsets.only(left: 6.0),
10095
text: "Phobos",
101-
value: 18,
10296
color: Colors.black,
10397
fontSize: 16.0,
10498
),
10599
RadioItem(
106100
padding: EdgeInsets.only(left: 6.0),
107101
text: "Dione",
108-
value: 16,
109102
color: Colors.black,
110103
fontSize: 16.0,
111104
),
112105
RadioItem(
113106
padding: EdgeInsets.only(left: 6.0),
114107
text: "James",
115-
value: 10,
116108
color: Colors.black,
117109
fontSize: 16.0,
118110
),
119111
RadioItem(
120112
padding: EdgeInsets.only(left: 6.0),
121113
text: "Lina",
122-
value: 25,
123114
color: Colors.black,
124115
fontSize: 16.0,
125116
),
@@ -160,7 +151,7 @@ YYDialog YYListViewDialogListRadio() {
160151
..listViewOfRadioButton(
161152
items: radioItems,
162153
height: 370,
163-
intialValue: 7,
154+
intialValue: 2,
164155
activeColor: Colors.deepPurpleAccent,
165156
onClickItemListener: (index) {
166157
var radioItem = radioItems[index];

‎example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ packages:
4747
path: ".."
4848
relative: true
4949
source: path
50-
version: "1.0.14"
50+
version: "1.0.20"
5151
flutter_test:
5252
dependency: "direct dev"
5353
description: flutter

‎lib/flutter_custom_dialog.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class YYDialog {
2828
Function() showCallBack; //展示的回调
2929
Function() dismissCallBack; //消失的回调
3030

31-
get isShowing => _isShowing; //当前弹窗是否可见
31+
get isShowing => _isShowing; //当前 弹窗是否可见
3232
bool _isShowing = false;
3333

3434
//============================================================================
@@ -574,7 +574,6 @@ class RadioItem {
574574
RadioItem({
575575
this.padding,
576576
this.text,
577-
this.value,
578577
this.color,
579578
this.fontSize,
580579
this.fontWeight,
@@ -583,7 +582,6 @@ class RadioItem {
583582

584583
EdgeInsets padding;
585584
String text;
586-
int value;
587585
Color color;
588586
double fontSize;
589587
FontWeight fontWeight;

‎lib/flutter_custom_dialog_widget.dart

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class YYRadioListTile extends StatefulWidget {
77
YYRadioListTile({
88
Key key,
99
this.items,
10-
this.intialValue=0,
10+
this.intialValue,
1111
this.activeColor,
1212
this.onChanged,
1313
}) : assert(items != null),
@@ -25,32 +25,38 @@ class YYRadioListTile extends StatefulWidget {
2525
}
2626

2727
class YYRadioListTileState extends State<YYRadioListTile> {
28-
var groupId = 0;
29-
var selectedItem = -1;
28+
var groupId = -1;
29+
30+
void intialSelectedItem() {
31+
//intialValue:
32+
//The button initializes the position.
33+
//If it is not filled, it is not selected.
34+
if (groupId == -1) {
35+
groupId = widget.intialValue ?? -1;
36+
}
37+
}
3038

3139
@override
3240
Widget build(BuildContext context) {
33-
if (selectedItem == -1) {
34-
selectedItem = widget.intialValue != null ? widget.intialValue : 0;
35-
}
41+
intialSelectedItem();
42+
3643
return ListView.builder(
3744
padding: EdgeInsets.all(0.0),
3845
shrinkWrap: true,
3946
itemCount: widget.items.length,
4047
itemBuilder: (BuildContext context, int index) {
41-
var radioItem = widget.items[index];
4248
return Material(
4349
color: Colors.white,
4450
child: RadioListTile(
45-
title: Text(radioItem.text),
46-
value: radioItem.value ==null?index: radioItem.value,
47-
groupValue: selectedItem,
51+
title: Text(widget.items[index].text),
52+
value: index,
53+
groupValue: groupId,
4854
activeColor: widget.activeColor,
4955
onChanged: (int value) {
5056
setState(() {
51-
selectedItem = value;
57+
widget.onChanged(value);
58+
groupId = value;
5259
});
53-
widget.onChanged(value);
5460
},
5561
),
5662
);

‎pubspec.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.2.0"
10+
version: "2.3.0"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
1414
name: boolean_selector
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "1.0.4"
17+
version: "1.0.5"
1818
charcode:
1919
dependency: transitive
2020
description:
@@ -52,28 +52,28 @@ packages:
5252
name: meta
5353
url: "https://pub.dartlang.org"
5454
source: hosted
55-
version: "1.1.6"
55+
version: "1.1.7"
5656
path:
5757
dependency: transitive
5858
description:
5959
name: path
6060
url: "https://pub.dartlang.org"
6161
source: hosted
62-
version: "1.6.2"
62+
version: "1.6.4"
6363
pedantic:
6464
dependency: transitive
6565
description:
6666
name: pedantic
6767
url: "https://pub.dartlang.org"
6868
source: hosted
69-
version: "1.7.0"
69+
version: "1.8.0+1"
7070
quiver:
7171
dependency: transitive
7272
description:
7373
name: quiver
7474
url: "https://pub.dartlang.org"
7575
source: hosted
76-
version: "2.0.3"
76+
version: "2.0.5"
7777
sky_engine:
7878
dependency: transitive
7979
description: flutter
@@ -106,7 +106,7 @@ packages:
106106
name: string_scanner
107107
url: "https://pub.dartlang.org"
108108
source: hosted
109-
version: "1.0.4"
109+
version: "1.0.5"
110110
term_glyph:
111111
dependency: transitive
112112
description:

‎pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_custom_dialog
22
description: Semantic dialog | Made In YY.inc | Welcome to contribute
3-
version: 1.0.20
3+
version: 1.0.17
44
author: AndroidHensen <xyj510402535@qq.com>
55
homepage: https://github.com/YYFlutter/flutter-custom-dialog.git
66

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /