skip to Main Content

The Logo should be slightly offset to the bottom and be between the body and the normal app bar.

Somehow no matter what I try with Overflowboxes or similar constructions the logo gets cutted of the one or the other way.

Image with the logo cutted off

      appBar: PreferredSize(
        preferredSize:
            Size.fromHeight(100), AppBar
        child: AppBar(
          title: Text(
            'My App',
            style: Theme.of(context).textTheme.headlineLarge,
          ),
          backgroundColor: Colors
              .transparent, 
          elevation: 0, 
        ),
      ),
      body: Stack(
        children: [
          ListView.builder(
            itemCount: DUMMY_MEALS.length,
            itemBuilder: (ctx, index) {
              final mealData = DUMMY_MEALS[index];
              return Padding(
                padding:
                    const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
                child: MealItemInOverview(
                    mealData.id,
                    mealData.title,
                    mealData.preparation_time,
                    mealData.ingredients,
                    mealData.steps),
              );
            },
          ),
          Positioned(
            top:
                -60,
            right:
                20, 
            child: CircleAvatar(
              radius:
                  50, 
              backgroundImage: AssetImage('assets/images/images.png'),
            ),
          ),
        ],
      ),
    );
  }
}

2

Answers


  1. Chosen as BEST ANSWER
    appBar: PreferredSize(
            preferredSize:
                Size.fromHeight(80), // Adjusted height to accommodate the overlap
            child: AppBar(
              title: Text(
                'My App',
                style: Theme.of(context).textTheme.headlineLarge,
              ),
              elevation: 0, 
              backgroundColor: Colors
                  .transparent, transparent.
              flexibleSpace: Stack(
                clipBehavior: Clip.none, // this changed it :)
                children: [
                  Positioned(
                    top:
                        70,
                    right:
                        16, 
                    child: CircleAvatar(
                      radius: 50, 
                      backgroundImage: AssetImage('assets/images/mylogo.png'),
                    ),
                  ),
                ],
              ),
            ),
    

  2. You can try adding clipBehavior on Stack.

    Stack(
      clipBehavior: Clip.none, //this is hardEdge by default
    ) 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search