flutterdartuser-interfaceborder-radius

Flutter - Way to design a Container with strange borderRadius


I need some help with building a user interface for my app. While browsing Dribbble, I came across a design that I think would be simple and fast to replicate. However, I'm struggling with creating a Container that has a unique borderRadius in Flutter.

Here's a link to the design: Dribble page design

I plan to add a black appBar with a leading and actions for the two icons and then create a Container in the body. However, I can't seem to figure out how to achieve the non-standard borderRadius on the bottom right corner.

Can you please help me with this? Thank you in advance for your assistance.


Solution

  • After reviewing your responses, I found this code to be the easiest to reproduce and fit the design I wanted.

    import 'package:flutter/material.dart';
    import 'package:gap/gap.dart';
    import 'package:google_fonts/google_fonts.dart';
    import 'package:ui_blackandwhite/components/course_card.dart';
    import 'package:ui_blackandwhite/components/langage_card.dart';
    import 'package:ui_blackandwhite/components/my_search_bar.dart';
    
    class HomePage extends StatelessWidget {
      const HomePage({super.key});
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          backgroundColor: Colors.white,
          appBar: AppBar(
            backgroundColor: Colors.black,
            leading: const Icon(
              Icons.menu_rounded,
              color: Colors.white,
              size: 30,
            ),
            actions: const [
              Icon(
                Icons.person,
                color: Colors.white,
                size: 30,
              ),
            ],
          ),
          body: Column(
            children: [
              // Barre de recherche
              Container(
                height: 100,
                decoration: const BoxDecoration(
                  color: Colors.black,
                  borderRadius: BorderRadius.only(
                    bottomLeft: Radius.circular(50.0),
                  ),
                ),
                child: const Center(child: MySearchBar()),
              ),
    
              // Reste de la page
              Expanded(
                child: Container(
                  color: Colors.black,
                  child: Container(
                    width: MediaQuery.of(context).size.width,
                    decoration: const BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.only(
                        topRight: Radius.circular(50.0),
                      ),
                    ),
                    child: Padding(
                      padding: const EdgeInsets.only(
                        top: 50.0,
                        left: 25.0,
                        right: 25.0,
                        bottom: 25.0,
                      ),
                      child: Column(
                        children: [
                          // Texte "recommendé pour vous"
                          Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              "Recommendé pour vous",
                              style: GoogleFonts.kanit(
                                fontSize: 25,
                                fontWeight: FontWeight.w600,
                              ),
                            ),
                          ),
    
                          const Gap(15.0),
    
                          // List View de quelques langages de programmations
                          SizedBox(
                            height: 100,
                            child: ListView.builder(
                              scrollDirection: Axis.horizontal,
                              itemBuilder: (context, index) {
                                return const LangageCard();
                              },
                            ),
                          ),
    
                          const Gap(75),
    
                          Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              "Dernières formations vues",
                              style: GoogleFonts.kanit(
                                fontSize: 25,
                                fontWeight: FontWeight.w600,
                              ),
                            ),
                          ),
    
                          const Gap(15.0),
    
                          Expanded(
                            child: ListView(
                              children: const [
                                CourseCard(title: "Front-End"),
                                CourseCard(title: "Back-End"),
                                CourseCard(title: "JavaScript"),
                              ],
                            ),
                          )
                        ],
                      ),
                    ),
                  ),
                ),
              ),
            ],
          ),
        );
      }
    }
    

    I created a container within another container, giving them different border-radius and colors.