浏览代码

fix erorrs

/zgh-devtools
Shiyun Wen 4 年前
当前提交
84e0c012
共有 4 个文件被更改,包括 80 次插入48 次删除
  1. 10
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_activity_indicator_demo.cs
  2. 71
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_refresh_demo.cs
  3. 15
      com.unity.uiwidgets/Runtime/cupertino/segmented_control.cs
  4. 32
      com.unity.uiwidgets/Runtime/cupertino/sliding_segmented_control.cs

10
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_activity_indicator_demo.cs


namespace UIWidgetsGallery.gallery {
public class CupertinoProgressIndicatorDemo : StatelessWidget {
public static string routeName = "/cupertino/progress_indicator";
automaticallyImplyLeading: false,
middle: new Text(
"Activity Indicator"
)
),
previousPageTitle: "Cupertino",
middle: new Text("Activity Indicator")
),
child: new Center(
child: new CupertinoActivityIndicator()
)

71
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_refresh_demo.cs


List<List<string>> randomizedContacts;
public override void initState() {
public override void initState()
{
void repopulateList() {
void repopulateList()
{
//List<string> nullStr = new List<string>();//{" "};
randomizedContacts = new List<List<string>>();
for (int index = 0; index < 100; index++ ){
contacts[random.Next()].Add(random.Next()%2 == 0 ? true.ToString() : false.ToString());
randomizedContacts.Add(contacts[random.Next()]);
for (int index = 0; index < 100; index++ )
{
var id = random.Next(contacts.Count);
if (id < contacts.Count)
{
contacts[id].Add(id % 2 == 0 ? true.ToString() : false.ToString());
randomizedContacts.Add(new List<string>());
for (int i = 0; i < 4; i++)
{
randomizedContacts[index].Add(contacts[id][i]);
}
}
_ListItem getListItem(int index)
{
if (index < randomizedContacts.Count && index > 0 )
{
return new _ListItem(
name: randomizedContacts[index][0],
place: randomizedContacts[index][1],
date: randomizedContacts[index][2],
called: randomizedContacts[index][3] == "true"
);
}
else
{
return new _ListItem();
}
}
previousPageTitle: "Cupertino"
//trailing: CupertinoDemoDocumentationButton(CupertinoRefreshControlDemo.routeName),
),

top: false, // Top safe area is consumed by the navigation bar.
sliver: new SliverList(
del: new SliverChildBuilderDelegate(
(BuildContext context1, int index)=> {
return new _ListItem(
name: randomizedContacts[index][0],
place: randomizedContacts[index][1],
date: randomizedContacts[index][2],
called: randomizedContacts[index][3] == "true"
);
(BuildContext context1, int index)=>
{
return getListItem(index);
},
childCount: 20
)

string name = null,
string place = null,
string date = null,
bool? called = null
bool called = false
)
{
this.name = name;

public readonly string name;
public readonly string place;
public readonly string date;
public readonly bool? called;
public readonly bool called;
public override Widget build(BuildContext context) {
return new Container(

children: new List<Widget>{
new Container(
width: 38.0f,
child: (bool)called
child: called
? new Align(
alignment: Alignment.topCenter,
child: new Icon(

)
: null
),
new Expanded(
child: new Container(
new Expanded(
child: new Container(
decoration: new BoxDecoration(
border: new Border(
bottom: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f)

mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: new List<Widget>{
new Text(
name,
name ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: new TextStyle(

),
new Text(
place,
place ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: new TextStyle(

)
),
new Text(
date,
date ?? "",
style: new TextStyle(
color: CupertinoColors.inactiveGray.resolveFrom(context),
fontSize: 15.0f,

15
com.unity.uiwidgets/Runtime/cupertino/segmented_control.cs


Color selectedColor = null,
Color borderColor = null,
Color pressedColor = null,
EdgeInsetsGeometry Padding = null
EdgeInsetsGeometry padding = null
{
D.assert(children != null);
{ D.assert(children != null);
D.assert(children.Count >= 2);
D.assert(onValueChanged != null);
D.assert(

this.children = children;
this.onValueChanged = onValueChanged;
this.groupValue = groupValue;
this.unselectedColor = unselectedColor;
this.selectedColor = selectedColor;
this.borderColor = borderColor;
this.pressedColor = pressedColor;
this.padding = padding;
}
public readonly Dictionary<T, Widget> children;
public readonly T groupValue;

}
_selectionControllers.Clear();
_childTweens.Clear();
foreach ( T key in widget.children.Keys) {
AnimationController animationController = createAnimationController();
if (widget.groupValue.Equals(key)) {

32
com.unity.uiwidgets/Runtime/cupertino/sliding_segmented_control.cs


{
D.assert(children != null);
D.assert(children.Count >= 2);
D.assert(padding != null);
D.assert(onValueChanged != null);
D.assert(
groupValue == null || children.Keys.Contains(groupValue),()=>

public _RenderSlidingSegmentedControl(
int? selectedIndex = null,
Color thumbColor = null,
_SlidingSegmentedControlState<T> state = null
_SlidingSegmentedControlState<T> state = null
highlightedIndex = selectedIndex;
_thumbColor = thumbColor;
state.drag.onDown = _onDown;
state.drag.onUpdate = _onUpdate;
state.drag.onEnd = _onEnd;
state.drag.onCancel = _onCancel;
state.tap.onTapUp = _onTapUp;
state.longPress.onLongPress = ()=> { };
}
public readonly _SlidingSegmentedControlState<T> state;
Dictionary<RenderBox, _ChildAnimationManifest> _childAnimations = new Dictionary<RenderBox, _ChildAnimationManifest>{};
_highlightedIndex = selectedIndex;
_thumbColor = thumbColor;
this.state = state;
this.state.drag.onDown = _onDown;
this.state.drag.onUpdate = _onUpdate;
this.state.drag.onEnd = _onEnd;
this.state.drag.onCancel = _onCancel;
this.state.tap.onTapUp = _onTapUp;
this.state.longPress.onLongPress = ()=> { };
}
public _SlidingSegmentedControlState<T> state;
Dictionary<RenderBox, _ChildAnimationManifest> _childAnimations = new Dictionary<RenderBox, _ChildAnimationManifest>{};
Rect currentThumbRect;

base.insert(child, after: after);
if (_childAnimations == null)
return;
D.assert(_childAnimations[child] == null);
D.assert(_childAnimations.getOrDefault(child) == null);
_childAnimations[child] = new _ChildAnimationManifest(separatorOpacity: 1);
}

transform: MatrixUtils.forceToPoint(center),
position: center,
hitTest: (BoxHitTestResult result1, Offset position1)=> {
D.assert(position == center);
D.assert(position1 == center);
return child.hitTest(result1, position: center);
}
);

正在加载...
取消
保存