浏览代码

Merge pull request #91 from Unity-Technologies/zgh/cupertino/fix

Zgh/cupertino/fix
/siyaoH-1.17-PlatformMessage
GitHub 4 年前
当前提交
e836f579
共有 5 个文件被更改,包括 52 次插入51 次删除
  1. 56
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine/expanding_bottom_sheet.cs
  2. 28
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine/shopping_cart.cs
  3. 3
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine/supplemental/product_card.cs
  4. 7
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/app.cs
  5. 9
      com.unity.uiwidgets/Runtime/widgets/scroll_position.cs

56
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine/expanding_bottom_sheet.cs


public class ExpandingBottomSheet : StatefulWidget {
public ExpandingBottomSheet(Key key = null, AnimationController hideController = null)
public ExpandingBottomSheet(
Key key = null,
AnimationController hideController = null)
: base(key: key)
{
D.assert(hideController != null);

}
}
Widget _buildThumbnails(int numProducts) {
return new Container(
child: new Opacity(
opacity: _thumbnailOpacityAnimation.value,
child: new Column(
children: new List<Widget>{
new Row(
children: new List<Widget>{
new AnimatedPadding(
padding: _cartPaddingFor(numProducts),
child: new Icon(Icons.shopping_cart),
duration: TimeSpan.FromMilliseconds(225)
),
new Container(
// Accounts for the overflow number
width: numProducts > 3 ? _width - 94.0f: _width - 64.0f,
height: expanding_buttom_sheetUtils._kCartHeight,
padding: EdgeInsets.symmetric(vertical: 8.0f),
child: new ProductThumbnailRow()
),
new ExtraProductsNumber(),
}
),
}
)
Widget _buildThumbnails(int numProducts)
{
return new Opacity(
opacity: _thumbnailOpacityAnimation.value,
child: new Column(
children: new List<Widget>
{
new Row(
children: new List<Widget>
{
/* new AnimatedPadding(
padding: _cartPaddingFor(numProducts),
child: new Icon(Icons.shopping_cart),
duration: TimeSpan.FromMilliseconds(225)
),*/
new Container(
// Accounts for the overflow number
width: numProducts > 3 ? _width - 94.0f : _width - 64.0f,
height: expanding_buttom_sheetUtils._kCartHeight,
padding: EdgeInsets.symmetric(vertical: 8.0f),
child: new ProductThumbnailRow()
)//, new ExtraProductsNumber(),
}
),
}
)
);
}

}
public readonly GlobalKey<AnimatedListState> listKey;
//public readonly Delegate removedItemBuilder;
public RemovedItemBuilder removedItemBuilder;
public readonly List<int> _items;

28
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine/shopping_cart.cs


using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Image = Unity.UIWidgets.widgets.Image;
using TextStyle = Unity.UIWidgets.painting.TextStyle;

List<Widget> _createShoppingCartRows(AppStateModel model)
{
List<Widget> widgets = new List<Widget>();
for (int id = 0; id < model.productsInCart.Count; id++)
foreach (var product in model.productsInCart.Keys)
widgets.Add(new ShoppingCartRow(
product: model.getProductById(id),
quantity: model.productsInCart[id],
onPressed: ()=> {
model.removeItemFromCart(id);
}
));
int id = product;
widgets.Add(new ShoppingCartRow(
product: model.getProductById(id),
quantity: model.productsInCart[id],
onPressed: ()=> {
model.removeItemFromCart(id);
}
));
}
return widgets;

public class ShoppingCartRow : StatelessWidget {
public ShoppingCartRow(
Product product = null,
int? quantity = null,
int quantity = 1,
this.quantity = quantity?? 0;
this.quantity = quantity;
this.onPressed = onPressed;
}

new Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: new List<Widget>{
Image.asset(
Image.file(
package: product.assetPackage,
//package: product.assetPackage,
fit: BoxFit.cover,
width: 75.0f,
height: 75.0f

new Expanded(
child: new Text($"Quantity: {quantity}")
),
new Text($"x $ {product.price : D} ")
new Text($"x $ {product.price :F} ")
}
),
new Text(

3
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine/supplemental/product_card.cs


using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.widgets;
using UnityEngine;
namespace UIWidgetsGallery.demo.shrine.supplemental
{

),
new SizedBox(height: 4.0f),
new Text(
$" $ { product.price:D}",
$" $ { product.price:F}",
style: theme.textTheme.caption
),
}

7
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/app.cs


namespace UIWidgetsGallery.gallery
{
public class GalleryApp : StatefulWidget
{
public GalleryApp(
{ public GalleryApp(
Key key = null,
UpdateUrlFetcher updateUrlFetcher = null,
bool enablePerformanceOverlay = true,

// Specifically use a blank Cupertino theme here and do not transfer
// over the Material primary color etc except the brightness to
// showcase standard iOS looks.
new Builder(builder: (BuildContext subsubContext) =>
new Builder(builder: (BuildContext context1) =>
brightness: Theme.of(context).brightness
brightness: Theme.of(context1).brightness
),
child: child
);

9
com.unity.uiwidgets/Runtime/widgets/scroll_position.cs


this.keepScrollOffset = keepScrollOffset;
this.debugLabel = debugLabel;
_coordinator = coordinator;
if (oldPosition != null) {
absorb(oldPosition);
}

public bool hasMaxScrollExtent {
get { return _maxScrollExtent != null; }
}
public override float pixels {
get {
D.assert(_pixels != null);

D.assert(other != null);
D.assert(other.context == context);
D.assert(_pixels == null);
_minScrollExtent = other.minScrollExtent;
_maxScrollExtent = other.maxScrollExtent;
_minScrollExtent = other._minScrollExtent;
_maxScrollExtent = other._maxScrollExtent;
_viewportDimension = other.viewportDimension;
_viewportDimension = other._viewportDimension;
D.assert(activity == null);
D.assert(other.activity != null);

正在加载...
取消
保存