0
import 'package:first/app_styles.dart';
import 'package:first/custom_tab_indicator.dart';
import 'package:first/size_config.dart';
import 'package:flutter/material.dart';
void main(){
  runApp(MyApp());
}
 class MyApp extends StatelessWidget {
   const MyApp({super.key});
 
   @override
   Widget build(BuildContext context) {
     return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
         body: HomePage(), 
          ),
     );
   }
 }
 class HomePage extends StatelessWidget {
   const HomePage({super.key});
 
   @override
   Widget build(BuildContext context) {
    SizeConfig().init(context);
     return SingleChildScrollView(
      physics: const BouncingScrollPhysics(),
      child: Column(
        children: [
          Container(
            color: kBackgroundColor,
            padding: const EdgeInsets.only(
              top: 52,
              left: 24,
              right: 24,
            ),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
              Column(
                children: [
                  Row(
                    children: [
                      Text(
                'All Inboxes',
                style: kJakartaHeading1.copyWith(
                      color: kDarkColor,
                      fontSize: SizeConfig.blockSizeHorizontal! * kHeading1
                ),
                ),
               const Icon(Icons.expand_more)
                    ],
                  ),
               Text('Total 2500 Messages , 3 Unread',
               style: kJakartaBodyMedium.copyWith(
                color: kParagraphColor,
                fontSize: SizeConfig.blockSizeHorizontal! * kBody1,
               ),
               )
                ],
              ),
             const CircleAvatar(
                maxRadius: 26,
                backgroundColor: kSecondaryColor,
                foregroundImage: NetworkImage("https://scontent.fbbi3-1.fna.fbcdn.net/v/t39.30808-6/290811895_737811837530600_5631746207860732425_n.jpg?_nc_cat=111&ccb=1-7&_nc_sid=174925&_nc_ohc=bC4YJN-G7XMAX9ScsYO&_nc_ht=scontent.fbbi3-1.fna&oh=00_AfDDgP91zqk5w95CPZegQJrNGLNGAOnJ2c1bPejkP8drGQ&oe=642CDE70"),
              )
            ]
            ),
          ),
          Container(
            height: 28,
            color: kBackgroundColor,
            child: SizedBox(
              height: 98,
              child: ListView.builder(
                itemCount: 10,
                physics: const BouncingScrollPhysics(),
                scrollDirection: Axis.horizontal,
              itemBuilder: (context,index)  {
                return Container(
                  margin: EdgeInsets.only(
                    left: index == 0 ? 24 : 0,
                    right: index == 9 ? 24 : 8,
                  ),
                  child: Column(
                    children: [
                      Stack(
                        children: [
                           const CircleAvatar(
                               maxRadius: 36,
                               backgroundColor: kWhiteColor,
                               foregroundImage: NetworkImage("https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.iconfinder.com%2Ficons%2F7123025%2Flogo_google_g_icon&psig=AOvVaw1P3y-6z6_Kqz7EkyFOa6mR&ust=1680431544395000&source=images&cd=vfe&ved=0CBAQjRxqFwoTCLiI8729iP4CFQAAAAAdAAAAABAD"),
                          ),
                          Positioned(
                            right: 0,
                          left: 0,
                            child: Container(
                              padding: const EdgeInsets.symmetric(
                                vertical: 2,
                                horizontal: 8,
                              ),
                              decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(20),
                                color: kPrimaryColor,
                              ),
                              child: IntrinsicWidth(
                                child: Text('12',
                              style: kJakartaBodyBold.copyWith(
                                color: kWhiteColor,
                                fontSize: SizeConfig.blockSizeHorizontal! * kBody2,
                              ),
                              ),
                              ),
                            ),
                            )
                        ],
                      ),
                      const SizedBox(height: 8,
                      ),
                      Text('Google',
                      maxLines: 1,
                      overflow: TextOverflow.ellipsis,
                      style: kJakartaBodyMedium.copyWith(
                        color: kParagraphColor,
                        fontSize: SizeConfig.blockSizeHorizontal! * kBody1,
                      ),
                      ),
                    ],
                  ),
                );
              }
              ),
            ),
          ),
          Container(
            height: 48,
            color: kBackgroundColor,
          ),
          Container(
            height: 30,
            transform: Matrix4.translationValues(0, -24, 0),
            decoration:const BoxDecoration(
              color: kWhiteColor,
              borderRadius: BorderRadius.only(
                topLeft: Radius.circular(32),
                topRight: Radius.circular(32)
              )
            ),
          ),
          Container(
            padding: const EdgeInsets.symmetric(
              horizontal: 24
            ),
            transform: Matrix4.translationValues(0, -36, 0),
            height: 30,
            child: Row(
              children: [
                Expanded(
                  child: Container(
                    alignment: Alignment.topLeft,
                    child: DefaultTabController(
                      length: 3,
                      child: TabBar(
                        labelPadding: const EdgeInsets.only( right: 24),
                        indicatorWeight: 8,
                        isScrollable: true,
                        labelColor: kDarkColor,
                        labelStyle: kJakartaBodyBold.copyWith(
                          fontSize: SizeConfig.blockSizeHorizontal! * kBody1,
                        ),
                        unselectedLabelColor: kDark40Color,
                        indicator: RoundedRectangleTabIndicator(color: kPrimaryColor, weight: 4, width: 24, padding: 12),
                      splashFactory: NoSplash.splashFactory,
                      overlayColor: MaterialStateProperty.resolveWith((states) => states.contains(MaterialState.focused) ? null : Colors.transparent,)
                     ,tabs: const [
                     Tab(text: 'Primary',),
                     Tab(text: 'Socia;',),
                     Tab(text: 'Forums',),
                     ]
                     ),
                    ),
                  ),
                ),
                SizedBox( height: 19.5,
               child: Row(
                crossAxisAlignment: CrossAxisAlignment.end,
               mainAxisAlignment: MainAxisAlignment.end,
               children: [
                const Icon(Icons.more_horiz),
                const SizedBox(width: 24),
                Text('Edit',
                style: kJakartaBodyBold.copyWith(
                  color: kDark40Color,
                          fontSize: SizeConfig.blockSizeHorizontal! * kBody1,
                        ),
                )
               ],
               ),
               )
              ],
            ),
          ),
          // Container(
          //   padding: EdgeInsets.only(top: 16),
          //   transform: Matrix4.translationValues(0, -36, 0),
          //   child: ListView.builder(itemBuilder: ),
          // )
        ],
      ),
     );
   }
 }

I am new to flutter .I was trying to run the app but it shows this error. ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ The following _TypeError was thrown building HomePage(dirty, dependencies: [MediaQuery]): type 'int' is not a subtype of type 'double'

The relevant error-causing widget was: HomePage HomePage:file:///D:/UI%20under%20FLutter/first/lib/main.dart:16:16

When the exception was thrown, this was the stack: #0 new RoundedRectangleTabIndicator (package:first/custom_tab_indicator.dart:11:65) #1 HomePage.build (package:first/main.dart:173:36) #2 StatelessElement.build (package:flutter/src/widgets/framework.dart:5038:49) #3 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4968:15) #4 Element.rebuild (package:flutter/src/widgets/framework.dart:4690:5) #5 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4950:5) #6 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4944:5) ... Normal element mounting (25 frames) #31 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16) #32 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6512:36) #33 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6524:32) ... Normal element mounting (318 frames) #351 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16) #352 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6512:36) #353 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6524:32) ... Normal element mounting (452 frames) #805 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16) #806 Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18) #807 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1176:16) #808 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1145:5) #809 RenderObjectToWidgetAdapter.attachToRenderTree. (package:flutter/src/widgets/binding.dart:1092:18) #810 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2682:19) #811 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1091:13) #812 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:926:7) #813 WidgetsBinding.scheduleAttachRootWidget. (package:flutter/src/widgets/binding.dart:906:7) #817 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26) (elided 3 frames from class _Timer and dart:async-patch)

kcbibek43
  • 1
  • 1
  • Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – Community Apr 01 '23 at 22:09

1 Answers1

1

One or more of the parameter values you are passing to RoundedRectangleTabIndicator should be a double. You are using integers. The information you get in the stack is quite specific and useful. You need to read and understand it.

Also your IDE should be able to indicate to you what the type of the parameters are.

GrahamD
  • 2,952
  • 3
  • 15
  • 26