javascript算法

问题描述 投票:0回答:1

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

flutter containers border card
1个回答
2
投票

enter image description here您需要通过使用

Container
属性在
BoxDecoration
内指定边框半径来向
borderRadius
小部件添加边框半径。这是示例代码:

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorSchemeSeed: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  final String title;

  const MyHomePage({
    super.key,
    required this.title,
  });

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Card(
        elevation: 6,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(15.0),
          side: const BorderSide(
            color: Color.fromRGBO(255, 128, 0, 1),
            width: 2.0,
          ),
        ),
        child: GestureDetector(
          onTap: () {},
          child: Container(
            width: 130,
            height: 100,
            decoration: BoxDecoration(
              color: const Color.fromRGBO(86, 89, 94, 1),
              borderRadius: BorderRadius.circular(15.0)
            ),
            padding: const EdgeInsets.all(15.0),
            child: Column(children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    "2",
                    style: Theme.of(context).textTheme.bodyLarge,
                  ),
                  Icon(
                    Icons.abc,
                    color: Colors.white,
                  ),
                ],
              ),
              Text(
                "test",
                style: const TextStyle(
                  fontSize: 20,
                  color: Colors.white,
                ),
              ),
            ]),
          ),
        ),
      )
    );
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.