当我的卡片滚动滚动时,我想将我的第一个容器固定在顶部
这是我的代码:
return SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
new SizedBox(height: 25.0,),
new Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
new Text("Top Fix",style: TextStyle(fontSize: 20.0)),
new SizedBox(width: 30.0,),
new CircleAvatar(
backgroundColor: Colors.white,
radius: 25.0,
child: Text("A"),
),
],
),
color: Colors.orange,
),
new Container(
height: 200.0,
width: double.infinity,
child: Container(
margin: EdgeInsets.only(top: 40.0),
child: Text(
"Welcome To \n Flutter",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
),
),
decoration: BoxDecoration(
borderRadius: new BorderRadius.only(
bottomLeft: new Radius.circular(50.0),
bottomRight: new Radius.circular(50.0),
),
color: Colors.orange),
),
new Container(
margin: EdgeInsets.only(left: 10.0, right: 10.0),
transform: Matrix4.translationValues(0.0, -40.0, 0.0),
child: new Card(
clipBehavior: Clip.antiAlias,
color: Colors.orange[300],
child: Row(
children: [
new Container(
margin: EdgeInsets.all(5.0),
child: CircleAvatar(
backgroundColor: Colors.white,
radius: 25.0,
child: Text("A"),
),
),
new Container(
child: Column(
children: [
new Text(
"Hello Every One This is Flutter Tutorial",
style: TextStyle(color: Colors.white),
),
new Container(
child: Row(
children: [
new FlatButton(
onPressed: () {},
textColor: Colors.white,
child: Text("Button 1")),
new FlatButton(
onPressed: () {},
textColor: Colors.white,
child: Text("Button 1")),
],
)),
],
)),
],
),
elevation: 2.0,
),
),
new Card(
clipBehavior: Clip.antiAlias,
color: Colors.grey[200],
child: Container(
height: 200.0,
width: double.infinity,
child: Text("Card 1"),
),
),
new SizedBox(
height: 40,
),
new Card(
clipBehavior: Clip.antiAlias,
color: Colors.grey[200],
child: Container(
height: 200.0,
width: double.infinity,
child: Text("Card 2"),
),
),
new SizedBox(
height: 40,
),
new Card(
clipBehavior: Clip.antiAlias,
color: Colors.grey[200],
child: Container(
height: 200.0,
width: double.infinity,
child: Text("Card 3"),
),
),
],
),
// ),
);
我想修复我的第一个容器,然后将颜色从橙色更改为绿色。
答案 0 :(得分:0)
您可以像这样使用堆栈:
[1] => Array
(
[product_number] => DZRW8
[product_id] => 28AHT
[type] => SHAREZ
[qty] => 1
)
[2] => Array
(
[product_number] => 4G0RY
[product_id] => MQFUQ
[type] =>
[qty] => 2
)
[3] => Array
(
[product_number] => ZS1C6
[product_id] => 28AHT
[type] => SOLOZ
[qty] => 1
)
)
//here's my code
$result = 0;
$values_type = "";
foreach($_SESSION["shopping_cart"] as $keys => $values)
{
$values_type = $values['type'];
if($values["product_id"] == $_POST["product_id"] && $values['type'] == $_POST['type'])
{
$item_array = array(
'product_number' => $values['product_number'],
'product_id' => $_POST["product_id"],
'type' => $_POST["type"],
'qty' => $_POST['qty'] + $values['qty']
);
$_SESSION["shopping_cart"][$keys] = $item_array;
$result = $keys;
$cart_action = "edit";
}
else {
$values_type = $values['type'];
$count = count($_SESSION["shopping_cart"]);
$item_array = array(
'product_number' => $product_number,
'product_id' => $_POST["product_id"],
'type' => $_POST["type"],
'qty' => $_POST['qty']
);
$result = $count;
$cart_action = "add";
}
}
if ($cart_action == "add") {
$_SESSION["shopping_cart"][$result] = $item_array;
echo $cart_action ." ". $values_type;
}
elseif ($cart_action == "edit") {
$_SESSION["shopping_cart"][$result] = $item_array;
echo $cart_action ." ". $values_type;
}
else {
echo "";
}