joostlek / GradientAppBar

Gradient app bar for Flutter
https://pub.dartlang.org/packages/gradient_app_bar
BSD 3-Clause "New" or "Revised" License
134 stars 68 forks source link

cannot hide elevation of the appbar #13

Closed itAlvy closed 5 years ago

itAlvy commented 5 years ago

I need a consistent gradient color as a whole, but I can't hide the elevation of the appbar.

  @override
  Widget build(BuildContext context) {

    Widget regionalSelectionContainer = Container(
      decoration: BoxDecoration(
          gradient: LinearGradient(colors: [
            Color(0xff1AB99D),
            Color(0xff2E2888)
          ])
        )
      );

    return Scaffold(
      backgroundColor: Color(0xfff2f1f8),
      appBar: GradientAppBar( //  just copy, no modification
        gradientStart: Color(0xff1AB99D),
        gradientEnd: Color(0xff2E2888),
        elevation: 0, // -----------invalid------------
        title: Text('Regional Selection', style: TextStyle(fontSize: 14)),
        centerTitle: true,
      ),
      body: Container(child: regionalSelectionContainer,)
    );
  }

Snipaste

joostlek commented 5 years ago

First things first, I released an update, where you can instead of give a start and an end color, give a gradient. (so it would look like:

@override
  Widget build(BuildContext context) {
    Gradient gradient =
        LinearGradient(colors: [Color(0xff1AB99D), Color(0xff2E2888)]);

    Widget regionalSelectionContainer =
        Container(decoration: BoxDecoration(gradient: gradient));

    return Scaffold(
        backgroundColor: Color(0xfff2f1f8),
        appBar: GradientAppBar(
          //  just copy, no modification
          gradient: gradient,
          elevation: 0, // -----------invalid------------
          title: Text('Regional Selection', style: TextStyle(fontSize: 14)),
          centerTitle: true,
        ),
        body: Container(
          child: regionalSelectionContainer,
        ));
  }

And when I run this, I get image

So could you maybe update your library and try it again?

itAlvy commented 5 years ago

First things first, I released an update, where you can instead of give a start and an end color, give a gradient. (so it would look like:

@override
  Widget build(BuildContext context) {
    Gradient gradient =
        LinearGradient(colors: [Color(0xff1AB99D), Color(0xff2E2888)]);

    Widget regionalSelectionContainer =
        Container(decoration: BoxDecoration(gradient: gradient));

    return Scaffold(
        backgroundColor: Color(0xfff2f1f8),
        appBar: GradientAppBar(
          //  just copy, no modification
          gradient: gradient,
          elevation: 0, // -----------invalid------------
          title: Text('Regional Selection', style: TextStyle(fontSize: 14)),
          centerTitle: true,
        ),
        body: Container(
          child: regionalSelectionContainer,
        ));
  }

And when I run this, I get image

So could you maybe update your library and try it again?

Thank you, this is great. So should I update the flutter version?

flutter version:1.7.8

flutter version

joostlek commented 5 years ago

You should change the version of gradient_app_bar to ^0.1.3, and then run flutter get again

itAlvy commented 5 years ago

You should change the version of gradient_app_bar to ^0.1.3, and then run flutter get again

Gradient gradient =
        LinearGradient(colors: [Color(0xff1AB99D), Color(0xff2E2888)]);

    Widget regionalSelectionContainer =
        Container(decoration: BoxDecoration(gradient: gradient));

    return Scaffold(
        backgroundColor: Color(0xfff2f1f8),
        appBar: GradientAppBar(
          gradient: gradient,
          elevation: 0, // -----------invalid------------
          title: Text('Regional Selection', style: TextStyle(fontSize: 14)),
          centerTitle: true,
        ),
        body: Container(
          child: regionalSelectionContainer,
        ));

gradient_app_bar: ^0.1.3 import 'package:gradient_app_bar/gradient_app_bar.dart';

It seems that it still doesn't work, emmmm...

微信截图_20190923142434

joostlek commented 5 years ago

Strange, do you still need me to look into it since you closed the issue?

itAlvy commented 5 years ago

Strange, do you still need me to look into it since you closed the issue?

Need help, I was accidentally shut down