浏览代码

fix

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
7ec28d6c
共有 11 个文件被更改,包括 764 次插入31 次删除
  1. 2
      Samples/UIWidgetsSamples_2019_4/Assets/Script/TextFieldTest.cs
  2. 45
      com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs
  3. 2
      com.unity.uiwidgets/Runtime/material/input_decorator.cs
  4. 9
      com.unity.uiwidgets/Runtime/services/keyboard.cs
  5. 4
      com.unity.uiwidgets/Runtime/widgets/framework.cs
  6. 89
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/TextFieldSample.cs
  7. 369
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/TextInputSample.cs
  8. 11
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/TextInputSample.cs.meta
  9. 243
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/ToDoAppSample.cs
  10. 21
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/UIWidgetsSamplePanel.cs
  11. 0
      /Samples/UIWidgetsSamples_2019_4/Assets/Script/TextFieldTest.cs

2
Samples/UIWidgetsSamples_2019_4/Assets/Script/TextFieldTest.cs


namespace UIWidgetsSample
{
public class TextField : UIWidgetsPanel
public class TextFieldTest : UIWidgetsPanel
{
protected void OnEnable()
{

45
com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs


#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
public partial class UIWidgetsPanel {
RenderTexture _renderTexture;
void _createRenderTexture(int width, int height, float devicePixelRatio) {
D.assert(_renderTexture == null);

texture = _renderTexture;
}
void _destroyRenderTexture() {
D.assert(_renderTexture != null);
texture = null;

void _enableUIWidgetsPanel(string font_settings)
{
void _enableUIWidgetsPanel(string font_settings) {
void _resizeUIWidgetsPanel()
{
void _resizeUIWidgetsPanel() {
_renderTexture.GetNativeTexturePtr(),
_width, _height, _devicePixelRatio);
_renderTexture.GetNativeTexturePtr(),
_width, _height, _devicePixelRatio);
IntPtr nativeTexturePtr, int width, int height, float dpi, string streamingAssetsPath, string font_settings);
IntPtr nativeTexturePtr, int width, int height, float dpi, string streamingAssetsPath,
string font_settings);
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_onRenderTexture(
IntPtr ptr, IntPtr nativeTexturePtr, int width, int height, float dpi);

IntPtr ptr, int width, int height, float dpi);
}
#endif
public partial class UIWidgetsPanel : RawImage {
[Serializable]
public struct Font {

[Serializable]
public struct TextFont {
public string family;

if (textFont == null || textFont.Length == 0) {
return null;
}
var result = new object[textFont.Length];
for (int i = 0; i < textFont.Length; i++) {
var font = new Dictionary<string, object>();

if (textFont[i].fonts[j].asset.Length > 0) {
dic[j].Add("asset", textFont[i].fonts[j].asset);
}
return result;
}

IntPtr _ptr;
GCHandle _handle;
int _width;
int _height;
float _devicePixelRatio;

if (fonts != null && fonts.Length > 0) {
settings.Add("fonts", fontsToObject(fonts));
}
_enableUIWidgetsPanel(JSONMessageCodec.instance.toJson(settings));
Input_OnEnable();

_handle = default;
_disableUIWidgetsPanel();
D.assert(!isolate.isValid);
base.OnDisable();
}

_isEntered = false;
UIWidgetsPanel_onMouseLeave(_ptr);
}
public void OnDrag(PointerEventData eventData) {
var pos = _getPointerPosition(Input.mousePosition);
if (pos == null) {

2
com.unity.uiwidgets/Runtime/material/input_decorator.cs


return _textAlignVertical;
}
set {
D.assert(value != null);
if (_textAlignVertical == value) {
return;
}

) : base(key: key) {
D.assert(decoration != null);
D.assert(textDirection != null);
D.assert(textAlignVertical != null);
D.assert(textBaseline != null);
D.assert(expands != null);
this.decoration = decoration;

9
com.unity.uiwidgets/Runtime/services/keyboard.cs


if (response.swallow) {
if (response.inputAction != null) {
Window.instance.run(
Timer.create(TimeSpan.Zero,
() => { TextInput._performAction(_client, response.inputAction.Value); });
}

}
if (ch == '\n') {
Window.instance.run(() => { TextInput._performAction(_client, TextInputAction.newline); });
Timer.create(TimeSpan.Zero, () => { TextInput._performAction(_client, TextInputAction.newline); });
}
if (_validateCharacter(ch)) {

else if (!string.IsNullOrEmpty(currentEvent.keyCode.ToString())) {
isIMEInput = true;
Debug.Log($"event:? {currentEvent}");
_value = _value.compose(currentEvent.keyCode.ToString());
}

if (_keyboard.status == TouchScreenKeyboard.Status.Done) {
if (!_screenKeyboardDone) {
_screenKeyboardDone = true;
Window.instance.run(() => {
Timer.create(TimeSpan.Zero, () => {
TextInput._performAction(_client,
TextInputAction.done);
});

_value = newValue;
if (changed) {
Window.instance.run(() => {
Timer.create(TimeSpan.Zero, () => {
TextInput._updateEditingState(_client,
_value);
});

4
com.unity.uiwidgets/Runtime/widgets/framework.cs


return true;
});
if (hasSameSuperclass && child.widget == newWidget) {
if (child.slot != newSlot) {
if (!Equals(child.slot, newSlot)) {
updateSlotForChild(child, newSlot);
}

if (child.slot != newSlot) {
if (!Equals(child.slot, newSlot)) {
updateSlotForChild(child, newSlot);
}

89
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/TextFieldSample.cs


using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample
{
public class TextFieldSample : UIWidgetsSamplePanel
{
protected override void main()
{
ui_.runApp(
new MaterialApp(
title: "Text Fields",
home: new MyCustomForm()
)
);
}
protected new void OnEnable()
{
base.OnEnable();
// TODO: add font
// FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/MaterialIcons-Regular"), "Material Icons");
}
}
class MyCustomForm : StatefulWidget
{
public override State createState()
{
return new _MyCustomFormState();
}
}
class _MyCustomFormState : State<MyCustomForm>
{
readonly TextEditingController myController = new TextEditingController();
public override void dispose()
{
this.myController.dispose();
base.dispose();
}
public override Widget build(BuildContext context)
{
return new Scaffold(
appBar: new AppBar(
title: new Text("Retrieve Text Input")
),
body: new Padding(
padding: EdgeInsets.all(16.0f)
,
child: new TextField(
controller: this.myController,
autofocus: true,
decoration: new InputDecoration(
hintText: "hinthere",
labelText: "pwd",
prefixIcon: new Icon(Unity.UIWidgets.material.Icons.search)
)
)
),
floatingActionButton: new FloatingActionButton(
// When the user presses the button, show an alert dialog with the
// text the user has typed into our text field.
onPressed: () =>
{
material_.showDialog<object>(
context: context,
builder: (_context) =>
{
return new AlertDialog(
// Retrieve the text the user has typed in using our
// TextEditingController
content: new Text(this.myController.text)
);
});
},
tooltip: "Show me the value",
child: new Icon(Icons.search)
)
);
}
}
}

369
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/TextInputSample.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample
{
public class TextInputSample : UIWidgetsSamplePanel
{
protected override void main()
{
ui_.runApp(
new MaterialApp(
home: new EditableInputTypeWidget()
)
);
}
protected new void OnEnable()
{
base.OnEnable();
}
class _TextInputSample : StatefulWidget
{
public readonly string title;
public _TextInputSample(Key key = null, string title = null) : base(key)
{
this.title = title;
}
public override State createState()
{
return new _TextInputSampleState();
}
}
class _TextInputSampleState : State<_TextInputSample>
{
TextEditingController titleController = new TextEditingController("");
TextEditingController descController = new TextEditingController("");
FocusNode _titleFocusNode;
FocusNode _descFocusNode;
public override void initState()
{
base.initState();
this._titleFocusNode = new FocusNode();
this._descFocusNode = new FocusNode();
}
public override void dispose()
{
this._titleFocusNode.dispose();
this._descFocusNode.dispose();
base.dispose();
}
Widget title()
{
return new Container(child: new Text(this.widget.title ?? "", textAlign: TextAlign.center,
style: new TextStyle(fontSize: 24, fontWeight: FontWeight.w700)),
margin: EdgeInsets.only(bottom: 20));
}
Widget titleInput()
{
return new Row(
children: new List<Widget>(
)
{
new SizedBox(width: 100, child: new Text("Title")),
new Flexible(child: new Container(
decoration: new BoxDecoration(border: Border.all(new Color(0xFF000000), 1)),
padding: EdgeInsets.fromLTRB(8, 0, 8, 0),
child: new EditableText(maxLines: 1,
controller: this.titleController,
selectionControls: MaterialUtils.materialTextSelectionControls,
backgroundCursorColor: Colors.transparent,
autofocus: true,
focusNode: new FocusNode(),
style: new TextStyle(
fontSize: 18,
height: 1.5f,
color: new Color(0xFF1389FD)
),
selectionColor: Color.fromARGB(255, 255, 0, 0),
cursorColor: Color.fromARGB(255, 0, 0, 0))
)),
}
);
}
Widget descInput()
{
return new Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 10),
child: new Row(
children: new List<Widget>(
)
{
new SizedBox(width: 100, child: new Text("Description")),
new Flexible(child: new Container(
height: 200,
decoration: new BoxDecoration(border: Border.all(new Color(0xFF000000), 1)),
padding: EdgeInsets.fromLTRB(8, 0, 8, 0),
child: new EditableText(maxLines: 200,
controller: this.descController,
backgroundCursorColor: Colors.transparent,
selectionControls: MaterialUtils.materialTextSelectionControls,
focusNode: new FocusNode(),
style: new TextStyle(
fontSize: 18,
height: 1.5f,
color: new Color(0xFF1389FD)
),
selectionColor: Color.fromARGB(255, 255, 0, 0),
cursorColor: Color.fromARGB(255, 0, 0, 0))
)),
}
));
}
public override Widget build(BuildContext context)
{
var container = new Container(
padding: EdgeInsets.all(10),
decoration: new BoxDecoration(color: new Color(0x7F000000),
border: Border.all(color: Color.fromARGB(255, 255, 0, 0), width: 5),
borderRadius: BorderRadius.all(2)),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: new List<Widget>
{
this.title(),
this.titleInput(),
this.descInput(),
}
)
);
return container;
}
}
}
public class EditableInputTypeWidget : StatefulWidget
{
public EditableInputTypeWidget(Key key = null) : base(key)
{
}
public override State createState()
{
return new _EditableInputTypeWidgetState();
}
}
class _EditableInputTypeWidgetState : State<EditableInputTypeWidget>
{
Widget rowWidgets(string title, Widget widget)
{
return new Container(
height: 80,
child: new Row(
children: new List<Widget>
{
new Container(width: 100,
child: new Text(title,
style: new TextStyle(fontSize: 14, height: 2.0f, color: Colors.black,
decoration: TextDecoration.none))),
new Flexible(child: new Container(child: widget, padding: EdgeInsets.all(4), decoration:
new BoxDecoration(border: Border.all(color: Color.black))))
}
));
}
void textSubmitted(string text)
{
Debug.Log($"text submitted {text}");
}
List<Widget> buildInputs(bool unityKeyboard)
{
List<Widget> widgets = new List<Widget>();
var style = new TextStyle();
var cursorColor = new Color(0xFF000000);
var selectionColor = new Color(0xFF6F6F6F);
widgets.Add(this.rowWidgets("Default", new EditStateProvider(builder: ((buildContext, controller, node) =>
new EditableText(controller: controller, focusNode: node, style: style, cursorColor: cursorColor,
backgroundCursorColor: Colors.blue,
selectionColor: selectionColor, onSubmitted: this.textSubmitted
, unityTouchKeyboard: unityKeyboard,
selectionControls: MaterialUtils.materialTextSelectionControls,
cursorWidth: 5.0f, cursorRadius: Radius.circular(2.5f), cursorOpacityAnimates: true,
paintCursorAboveText: true)))));
widgets.Add(this.rowWidgets("Multiple Line", new EditStateProvider(
builder: ((buildContext, controller, node) =>
new EditableText(controller: controller, focusNode: node, style: style, cursorColor: cursorColor,
backgroundCursorColor: Colors.transparent,
selectionColor: selectionColor, maxLines: 4,
onSubmitted: this.textSubmitted, unityTouchKeyboard: unityKeyboard,
selectionControls: MaterialUtils.materialTextSelectionControls
// ,
// globalKeyEventHandler: (evt, enableCustomAction) => {
// //customized key event handler which may swallow input keys to the editable and
// //perform customized functionality
// //
// //evt is the input rawKeyEvent
// //you should perform any customized functionality within the closure of "if(enableCustomAction) {}",
// //otherwise it could be performed multiple times for a single key event.
// //
// //Very Important: for any input event, please ensure that all the output RawInputKeyResponse is the same
// //regardless of the value of enableCustomAction, otherwise the behavior of this handler would become
// //wrong and unpredictable
// if (evt.data.unityEvent.keyCode == KeyCode.UpArrow) {
// if (enableCustomAction) {
// Debug.Log("UpUpUp");
// }
//
// return RawInputKeyResponse.swallowResponse;
// }
//
// if (evt.data.unityEvent.keyCode == KeyCode.DownArrow) {
// if (enableCustomAction) {
// Debug.Log("UpUpUp");
// }
//
// return RawInputKeyResponse.swallowResponse;
// }
//
// if (evt.data.unityEvent.character == '\n' ||
// evt.data.unityEvent.character == '\r' ||
// evt.data.unityEvent.character == 3 ||
// evt.data.unityEvent.character == 10) {
//
// if (evt.data.unityEvent.shift) {
// if (enableCustomAction) {
// Debug.Log("shift return >>>");
// }
// return new RawInputKeyResponse(true, evt.data.unityEvent.character, inputAction: TextInputAction.newline);
// }
// else {
// if (enableCustomAction) {
// Debug.Log("send !!!!");
// }
// return RawInputKeyResponse.swallowResponse;
// }
// }
//
// return RawInputKeyResponse.convert(evt);
// }
)))));
widgets.Add(this.rowWidgets("ObscureText", new EditStateProvider(
builder: ((buildContext, controller, node) =>
new EditableText(controller: controller, focusNode: node, style: style, cursorColor: cursorColor,
backgroundCursorColor: Colors.transparent,
selectionColor: selectionColor, obscureText: true,
onSubmitted: this.textSubmitted, unityTouchKeyboard: unityKeyboard,
selectionControls: MaterialUtils.materialTextSelectionControls)))));
widgets.Add(this.rowWidgets("Number", new EditStateProvider(builder: ((buildContext, controller, node) =>
new EditableText(controller: controller, focusNode: node, style: style, cursorColor: cursorColor,
backgroundCursorColor: Colors.transparent,
selectionColor: selectionColor, keyboardType: TextInputType.number,
onSubmitted: this.textSubmitted, unityTouchKeyboard: unityKeyboard,
selectionControls: MaterialUtils.materialTextSelectionControls)))));
widgets.Add(this.rowWidgets("Phone", new EditStateProvider(builder: ((buildContext, controller, node) =>
new EditableText(controller: controller, focusNode: node, style: style, cursorColor: cursorColor,
backgroundCursorColor: Colors.transparent,
selectionColor: selectionColor, keyboardType: TextInputType.phone,
onSubmitted: this.textSubmitted, unityTouchKeyboard: unityKeyboard,
selectionControls: MaterialUtils.materialTextSelectionControls)))));
widgets.Add(this.rowWidgets("Email", new EditStateProvider(builder: ((buildContext, controller, node) =>
new EditableText(controller: controller, focusNode: node, style: style, cursorColor: cursorColor,
backgroundCursorColor: Colors.transparent,
selectionColor: selectionColor, keyboardType: TextInputType.emailAddress,
onSubmitted: this.textSubmitted, unityTouchKeyboard: unityKeyboard,
selectionControls: MaterialUtils.materialTextSelectionControls)))));
widgets.Add(this.rowWidgets("Url", new EditStateProvider(builder: ((buildContext, controller, node) =>
new EditableText(controller: controller, focusNode: node, style: style, cursorColor: cursorColor,
backgroundCursorColor: Colors.transparent,
selectionColor: selectionColor, keyboardType: TextInputType.url,
onSubmitted: this.textSubmitted, unityTouchKeyboard: unityKeyboard,
selectionControls: MaterialUtils.materialTextSelectionControls)))));
return widgets;
}
public override Widget build(BuildContext context)
{
List<Widget> widgets = new List<Widget>();
widgets.Add(new Text("UIWidgets Touch Keyboard",
style: new TextStyle(fontSize: 20, height: 2.0f, color: Colors.black, decoration: TextDecoration.none),
textAlign: TextAlign.center));
widgets.AddRange(this.buildInputs(false));
widgets.Add(new Text("Unity Touch Keyboard",
style: new TextStyle(fontSize: 20, height: 2.0f, color: Colors.black, decoration: TextDecoration.none),
textAlign: TextAlign.center));
widgets.AddRange(this.buildInputs(true));
return new Container(
padding: EdgeInsets.all(12),
child: new SingleChildScrollView(child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: widgets)));
}
}
public class EditStateProvider : StatefulWidget
{
public delegate EditableText EditableBuilder(BuildContext context,
TextEditingController controller, FocusNode focusNode);
public readonly EditableBuilder builder;
public EditStateProvider(Key key = null, EditableBuilder builder = null) : base(key)
{
D.assert(builder != null);
this.builder = builder;
}
public override State createState()
{
return new _EditStateProviderState();
}
}
class _EditStateProviderState : State<EditStateProvider>
{
TextEditingController _controller;
FocusNode _focusNode;
public override void initState()
{
base.initState();
this._focusNode = new FocusNode();
this._controller = new TextEditingController("");
}
public override void dispose()
{
this._focusNode.dispose();
base.dispose();
}
public override Widget build(BuildContext context)
{
return this.widget.builder(context, this._controller, this._focusNode);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/TextInputSample.cs.meta


fileFormatVersion: 2
guid: aadc2d983f1b0564688e35a7d4933599
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

243
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/ToDoAppSample.cs


using System.Collections.Generic;
using System.Linq;
using uiwidgets;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
using Texture = Unity.UIWidgets.widgets.Texture;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample
{
public class ToDoAppSample : UIWidgetsSamplePanel
{
protected override void main()
{
ui_.runApp(
new WidgetsApp(
home: new ToDoListApp(),
pageRouteBuilder: this.pageRouteBuilder)
);
}
protected new void OnEnable()
{
base.OnEnable();
}
public class ToDoListApp : StatefulWidget
{
public ToDoListApp(Key key = null) : base(key)
{
}
public override State createState()
{
return new _ToDoListAppState();
}
}
public class CustomButton : StatelessWidget
{
public CustomButton(
Key key = null,
GestureTapCallback onPressed = null,
EdgeInsets padding = null,
Color backgroundColor = null,
Widget child = null
) : base(key: key)
{
this.onPressed = onPressed;
this.padding = padding ?? EdgeInsets.all(8.0f);
this.backgroundColor = backgroundColor ?? Colors.transparent;
this.child = child;
}
public readonly GestureTapCallback onPressed;
public readonly EdgeInsets padding;
public readonly Widget child;
public readonly Color backgroundColor;
public override Widget build(BuildContext context)
{
return new GestureDetector(
onTap: this.onPressed,
child: new Container(
padding: this.padding,
color: this.backgroundColor,
child: this.child
)
);
}
}
class _ToDoListAppState : State<ToDoListApp>
{
public class ToDoItem
{
public int id;
public string content;
}
List<ToDoItem> items = new List<ToDoItem>();
int nextId = 0;
TextEditingController controller = new TextEditingController("");
FocusNode _focusNode;
public override void initState()
{
base.initState();
this._focusNode = new FocusNode();
}
public override void dispose()
{
this._focusNode.dispose();
base.dispose();
}
Widget title()
{
return new Text("ToDo App", textAlign: TextAlign.center,
style: new TextStyle(fontSize: 30, fontWeight: FontWeight.w700));
}
Widget textInput()
{
return new Container(
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: new List<Widget>(
)
{
new Container(
width: 300,
decoration: new BoxDecoration(border: Border.all(new Color(0xFF000000), 1)),
padding: EdgeInsets.fromLTRB(8, 0, 8, 0),
child: new EditableText(maxLines: 1,
controller: this.controller,
onSubmitted: (text) =>
{
this.controller.clear();
this._addItem(text);
},
selectionControls: MaterialUtils.materialTextSelectionControls,
backgroundCursorColor: Colors.red,
autofocus: true,
focusNode: new FocusNode(),
style: new TextStyle(
fontSize: 18,
height: 1.5f,
color: new Color(0xFF1389FD)
),
selectionColor: Color.fromARGB(255, 255, 0, 0),
cursorColor: Color.fromARGB(255, 0, 0, 0))
),
new CustomButton(backgroundColor: Color.fromARGB(255, 0, 204, 204),
padding: EdgeInsets.all(10),
child: new Text("Add", style: new TextStyle(
fontSize: 20, color: Color.fromARGB(255, 255, 255, 255), fontWeight: FontWeight.w700
)), onPressed: () => { this._addItem(); })
}
)
);
}
void _addItem(string text = null)
{
this.setState(() =>
{
text = text ?? this.controller.text;
if (text != "")
{
this.items.Add(new ToDoItem()
{id = this.nextId++, content = text});
}
});
}
Widget contents()
{
var children = this.items.Select((item) =>
{
return (Widget) new Text(
item.content, style: new TextStyle(
fontSize: 18,
height: 1.5f
)
);
});
return new Flexible(
child: new ListView(
physics: new AlwaysScrollableScrollPhysics(),
children: children.ToList()
)
);
}
public override Widget build(BuildContext context)
{
var container = new Container(
padding: EdgeInsets.all(10),
decoration: new BoxDecoration(color: new Color(0x7F000000),
border: Border.all(color: Color.fromARGB(255, 255, 0, 0), width: 5),
borderRadius: BorderRadius.all(2)),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: new List<Widget>
{
this.title(),
this.textInput(),
// textInput(),
this.contents(),
// this.videoTexture(),
}
)
);
return container;
}
}
}
public class CustomButton : StatelessWidget
{
public CustomButton(
Key key = null,
GestureTapCallback onPressed = null,
EdgeInsets padding = null,
Color backgroundColor = null,
Widget child = null
) : base(key: key)
{
this.onPressed = onPressed;
this.padding = padding ?? EdgeInsets.all(8.0f);
this.backgroundColor = backgroundColor ?? Colors.transparent;
this.child = child;
}
public readonly GestureTapCallback onPressed;
public readonly EdgeInsets padding;
public readonly Widget child;
public readonly Color backgroundColor;
public override Widget build(BuildContext context)
{
return new GestureDetector(
onTap: this.onPressed,
child: new Container(
padding: this.padding,
color: this.backgroundColor,
child: this.child
)
);
}
}
}

21
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/UIWidgetsSamplePanel.cs


using Unity.UIWidgets.animation;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.widgets;
namespace UIWidgetsSample {
public class UIWidgetsSamplePanel: UIWidgetsPanel {
protected virtual PageRouteFactory pageRouteBuilder {
get {
return (RouteSettings settings, WidgetBuilder builder) =>
new PageRouteBuilder(
settings: settings,
pageBuilder: (BuildContext context, Animation<float> animation,
Animation<float> secondaryAnimation) => builder(context)
);
}
}
}
}

/Samples/UIWidgetsSamples_2019_4/Assets/Script/TextField.cs → /Samples/UIWidgetsSamples_2019_4/Assets/Script/TextFieldTest.cs

正在加载...
取消
保存