Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 3218e90

Browse files
author
Yuncong Zhang
committed
Fix some issues. Add samples.
1 parent 856b8a2 commit 3218e90

11 files changed

+1238
-12
lines changed

Runtime/material/app.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Collections.Generic;
22
using Unity.UIWidgets.animation;
33
using Unity.UIWidgets.foundation;
4+
using Unity.UIWidgets.service;
45
using Unity.UIWidgets.ui;
56
using Unity.UIWidgets.widgets;
67
using TextStyle = Unity.UIWidgets.painting.TextStyle;
@@ -158,14 +159,25 @@ public override Widget build(BuildContext context) {
158159
initialRoute: this.widget.initialRoute,
159160
onGenerateRoute: this.widget.onGenerateRoute,
160161
onUnknownRoute: this.widget.onUnknownRoute,
161-
builder: (BuildContext congtext, Widget child) => {
162-
ThemeData theme = this.widget.theme ?? ThemeData.fallback();
162+
builder: (BuildContext _context, Widget child) => {
163+
ThemeData theme;
164+
Brightness platformBrightness = MediaQuery.platformBrightnessOf(_context);
165+
if (platformBrightness == Brightness.dark && this.widget.darkTheme != null) {
166+
theme = this.widget.darkTheme;
167+
}
168+
else if (this.widget.theme != null) {
169+
theme = this.widget.theme;
170+
}
171+
else {
172+
theme = ThemeData.fallback();
173+
}
174+
163175
return new AnimatedTheme(
164176
data: theme,
165177
isMaterialAppTheme: true,
166178
child: this.widget.builder != null
167179
? new Builder(
168-
builder: (_context) => { return this.widget.builder(_context, child); }
180+
builder: (__context) => { return this.widget.builder(__context, child); }
169181
)
170182
: child
171183
);

Runtime/material/bottom_app_bar_theme.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ public BottomAppBarTheme(
1010
float? elevation = null,
1111
NotchedShape shape = null
1212
) {
13+
this.color = color;
14+
this.elevation = elevation;
15+
this.shape = shape;
1316
}
1417

1518
public readonly Color color;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using Unity.UIWidgets.animation;
2+
using Unity.UIWidgets.engine;
3+
using Unity.UIWidgets.material;
4+
using Unity.UIWidgets.widgets;
5+
using UnityEngine;
6+
7+
namespace UIWidgetsSample {
8+
public class LongPressSample: UIWidgetsSamplePanel {
9+
10+
protected override Widget createWidget() {
11+
return new WidgetsApp(
12+
home: new LongPressSampleWidget(),
13+
pageRouteBuilder: this.pageRouteBuilder);
14+
}
15+
}
16+
17+
public class LongPressSampleWidget: StatefulWidget {
18+
public override State createState() {
19+
return new _LongPressSampleWidgetState();
20+
}
21+
}
22+
23+
class _LongPressSampleWidgetState : State<LongPressSampleWidget> {
24+
public override Widget build(BuildContext context) {
25+
return new GestureDetector(
26+
onLongPressDragStart: (value) => {
27+
Debug.Log($"Long Press Drag Start: {value}");
28+
},
29+
onLongPressDragUpdate: (value) => {
30+
Debug.Log($"Long Press Drag Update: {value}");
31+
},
32+
onLongPressDragUp: (value) => {
33+
Debug.Log($"Long Press Drag Up: {value}");
34+
},
35+
child: new Center(
36+
child: new Container(
37+
width: 200,
38+
height: 200,
39+
color: Colors.blue
40+
)
41+
)
42+
);
43+
}
44+
}
45+
}

Samples/UIWidgetSample/LongPressSample.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)