简体   繁体   English

如何在 flutter 中制作这样的容器边框?

[英]how to make border of container like this in flutter?

I want to make a container border like this but don't know what should I use?我想制作这样的容器边框,但不知道我应该使用什么?

我想制作这样的容器边框,但不知道我应该使用什么?帮我

TRy following this code.尝试遵循此代码。 You have to customize it more to suit your exact needs.您必须对其进行更多自定义以满足您的确切需求。 Here we are using BoxDecoration properties to set every corner radius.这里我们使用BoxDecoration属性来设置每个角的半径。 Check at https://dartpad.dev/?id=61468d155191404e24d99404ebb297ea .https://dartpad.dev/?id=61468d155191404e24d99404ebb297ea 查看 This one matches the desgn consideration to a certain level but not exact.这个在一定程度上符合设计考虑,但不准确。 This one is simple, other wise to make exact the same as you shown you can use ClipPath.这个很简单,否则要与您展示的完全相同,您可以使用 ClipPath。

import 'package:flutter/material.dart';

const Color darkBlue = Color.fromARGB(255, 18, 32, 47);

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark().copyWith(
        scaffoldBackgroundColor: darkBlue,
      ),
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: MyWidget(),
        ),
      ),
    );
  }
}

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(right: 16,left: 16,top: 16,bottom: 64),
        height: MediaQuery.of(context).size.height*0.80,
        width: MediaQuery.of(context).size.width-32,
        decoration: BoxDecoration(
 
          color: Colors.blue,
          borderRadius: BorderRadius.only(
              topLeft: Radius.circular(0),
              bottomLeft: Radius.circular(MediaQuery.of(context).size.width*.4),
              bottomRight: Radius.circular(32.0),
              topRight: Radius.circular(0)),
          boxShadow: <BoxShadow>[
            BoxShadow(
                color: Colors.grey.withOpacity(1),
                offset: Offset(2, 2),
                blurRadius: 10.0),
          ],
 
        ),
      
    );
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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