简体   繁体   中英

how to make a icon get out from container on flutter

Hi guys i'm try to make this on flutter: img

i'm try with that code, but work

    Container(
      child: Positioned(top:0, left:0)
    )```

as an option you can use Stack as container for card widget + image

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Stack(
            children: <Widget>[
              Card(
                color: Colors.blueAccent,
                child: Container(
                  width: 300,
                  height: 80,
                ),
              ),
              FractionalTranslation(
                translation: Offset(0, -0.5),
                child: Icon(Icons.android, size: 48),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM