0

I've used the sliver appbar widget to create a UI, but my problem is that I can't control the scroll.

what I want is when it scrolled the text color changes and vice versa.

my code:

import 'package:flutter/material.dart';

class Sliver extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: NestedScrollView(
        headerSliverBuilder: (context, isScrolled) {
          return <Widget>[
            SliverAppBar(
              backgroundColor: Colors.white,
              title: Text(
                'Alexander Sebastian',
                style: TextStyle(
                  color: isScrolled ? Colors.black : Colors.white,
                ),
              ),
            ),
          ];
        },
        body: Center(
          child: Text(
            'Body',
          ),
        ),
      ),
    );
  }
}
the coder
  • 400
  • 1
  • 9
  • 17

0 Answers0