0

I want to add extended app bar with pattern for background. Below this fill screen with scrollable content. And above both views in center i want to show "header content".

My current view

  1. Currently i'm using CompositedTransformTarget and showing overlay. The problem which i have is that i have to hide/show overlay when navigation to next screen and then back. Is there any event for pause/resume widget?
@override
  Widget build(BuildContext context) {
    return PopScope(
        canPop: true,
        onPopInvoked: (didPop) {
          _removeHeaderInfoOverlay();
        },
        child: Scaffold(
          body:
              Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [
            Container(
              decoration: BoxDecoration(
                  boxShadow: [
                    BoxShadow(
                      color: Colors.grey.withOpacity(0.5),
                      spreadRadius: 5,
                      blurRadius: 7,
                      offset: Offset(0, 3), // changes position of shadow
                    ),
                  ],
                  color: Color(0xff00B9FF),
                  image: const DecorationImage(
                    fit: BoxFit.fill,
                    image: AssetImage('assets/images/app_bar_pattern.png'),
                  )),
              child: Column(
                children: [
                  _appBarView(context),
                  CompositedTransformTarget(
                    link: _layerLink,
                    child: SizedBox(height: shopOverviewHeight / 2),
                  )
                ],
              ),
            ),
            Expanded(
                child: SingleChildScrollView(
                    padding: const EdgeInsets.only(left: 10, right: 10),
                    physics: const AlwaysScrollableScrollPhysics(),
                    child: _prepareShopItem(widget.data)))
          ]),
        ));
  }

@override
  void initState() {
    super.initState();
    Future.delayed(const Duration(milliseconds: 500), () {
      _insertHeaderItem();
    });
  }
  1. I could use stack and add fix padding from top. Are appBars the same height on all devices (IOS,Android) in flutter ?

  2. Between my appBar and SingleChildScrollView when scrolling appBar shadow is below items.

I have try all i could find

1 Answer 1

0

even there are different sizes of AppBars you can link the top of the SingleChildScrollView link it to the position of your container using stack

1 to get the top of SingleChildScrollView : GlobalKey key = GlobalKey(); // declare a global key

2 SingleChildScrollView(key:GlobalKey)

3 get the top RenderBox box = key.currentContext.findRenderObject() as RenderBox; Offset position = box.localToGlobal(Offset.zero); //this is global position double y = position.dy;

4 put this top as a top of your Container using Positioned(top: )

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.