skip to Main Content

I have had this same issue as discussed in
https://github.com/flutter/flutter/issues/100067

I was able to get the flutter Webview.
But I need to change the color from Aqua to Blue as shown in the plus button in bottom Navigation bar. Please Help. enter image description here

2

Answers


  1. Try below code, refer showDatePicker

    builder: (context, child) {
            return Theme(
              data: Theme.of(context).copyWith(
                colorScheme: const ColorScheme.light(
                  primary: Colors.indigo,//add your + button color here
                 ),
                textButtonTheme: TextButtonThemeData(
                  style: TextButton.styleFrom(
                    foregroundColor: Colors.indigo, // button text color
                  ),
                ),
              ),
              child: child!,
            );
          },
    

    Full Code:

    import 'dart:async';
    
    import 'package:flutter/material.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          home: MyHomePage(),
        );
      }
    }
    
    class MyHomePage extends StatefulWidget {
      MyHomePage({Key? key}) : super(key: key);
    
      @override
      _MyHomePageState createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
      DateTime selectedDate = DateTime.now();
    
      Future<void> _selectDate(BuildContext context) async {
        final DateTime? picked = await showDatePicker(
          context: context,
          initialDate: selectedDate,
          firstDate: DateTime(2015, 8),
          lastDate: DateTime(2101),
          builder: (context, child) {
            return Theme(
              data: Theme.of(context).copyWith(
                colorScheme: const ColorScheme.light(
                  primary: Colors.indigo,
                 ),
                textButtonTheme: TextButtonThemeData(
                  style: TextButton.styleFrom(
                    foregroundColor: Colors.indigo, // button text color
                  ),
                ),
              ),
              child: child!,
            );
          },
        );
        if (picked != null && picked != selectedDate) {
          setState(() {
            selectedDate = picked;
          });
        }
      }
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text('Datepicker'),
          ),
          body: Center(
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: <Widget>[
                Text("${selectedDate.toLocal()}".split(' ')[0]),
                SizedBox(
                  height: 20.0,
                ),
                ElevatedButton(
                  onPressed: () => _selectDate(context),
                  child: Text('Select date'),
                ),
              ],
            ),
          ),
        );
      }
    }
    

    Result-> image

    Login or Signup to reply.
  2. Refer the issue and configuration

    1. Open the build.gradle file for your application.

    2. Make sure that the repositories section includes Google’s Maven Repository google(). For example:

        allprojects {
         repositories { 
         google() 
         centre() 
        }
      }
      

    Add the library to the dependencies section:

    dependencies {
        // ...
        implementation 'com.google.android.material:material:1.7'
        // ...
      }
    
    1. Set the light theme in /android/app/src/main/res/values/styles.xml:
      content_copy
      change

    to

    <style name="NormalTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
    
    1. Set the dark theme in /android/app/src/main/res/values-night/styles.xml
      content_copy
      change

    to

    <style name="NormalTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search