۳ Ali Gotvandi
ارور widget
جامعه فلاتر ایجاد شده در ۱۱ تیر ۱۴۰۱

سلام این ارور برای من اومده باید چه کاری انجام بدم؟

d48a-Untitled.png

سلام وقت بخیر

اطلاعاتی که در اختیار ما گذاشتید برای رفع ارور ناچیز هست و نسبت به این عکس ما نمیتونیم کمکتون کنیم یا دیباگ کنید و یا سورس پیوست کنید در اسرع وقت رسیدگی میشه

متین عفتی ۱۱ تیر ۱۴۰۱، ۱۲:۱۸
void main() {
 runApp(const MyApp());
}
class MyApp extends StatefulWidget {
 const MyApp({Key? key}) : super(key: key);
 @override
 State createState() => _MyAppState();
}
class _MyAppState extends State {
 ThemeMode _themeMode=ThemeMode.dark;
 // This widget is the root of your application.
 @override
 Widget build(BuildContext context) {
  Color surfaceColor = Color(0X0dffffff);
  Color primeryColor = Colors.pink.shade400;
  return MaterialApp(
   title: 'Flutter Frist Project',
   theme: _themeMode==ThemeMode.dark?MyAppThemeConfig.dark().gettheme():MyAppThemeConfig.light().gettheme(),
   home: MyHomePage(toggleThemeMode: (() {
    setState(() {
     if(_themeMode==ThemeMode.dark)
     _themeMode=ThemeMode.light;
     else
     _themeMode=ThemeMode.dark;
    });
   })),
  );
 }
}
class MyAppThemeConfig {
 final Brightness brightness;
 final Color primaryColor= Colors.pink.shade400;
 final Color primarTextColor;
 final Color secondryTextColor;
 final Color surfaceColor;
 final Color backgroundColor;
 final Color appBarColor;
ThemeData gettheme(){
 return ThemeData(
    // This is the theme of your application.
    //
    // Try running your application with "flutter run". You'll see the
    // application has a blue toolbar. Then, without quitting the app, try
    // changing the primarySwatch below to Colors.green and then invoke
    // "hot reload" (press "r" in the console where you ran "flutter run",
    // or simply save your changes to "hot reload" in a Flutter IDE).
    // Notice that the counter didn't reset back to zero; the application
    // is not restarted.
    primarySwatch: Colors.pink,
    primaryColor: primaryColor,
    brightness: brightness,
    dividerColor: surfaceColor,
    scaffoldBackgroundColor:backgroundColor,
    appBarTheme:
      AppBarTheme(
       elevation: 0,
       backgroundColor: appBarColor,
      foregroundColor: primarTextColor),
    inputDecorationTheme: InputDecorationTheme(
      border: OutlineInputBorder(
        borderRadius: BorderRadius.circular(8),
        borderSide: BorderSide.none),
      filled: true),
    textTheme: GoogleFonts.latoTextTheme(
     TextTheme(
      bodyText2: TextStyle(fontSize: 15,color:primarTextColor ),
      bodyText1:
        TextStyle(fontSize: 13, color: secondryTextColor),
      headline6: TextStyle(fontWeight: FontWeight.bold,color: primarTextColor),
      subtitle1: TextStyle(fontSize: 15, fontWeight: FontWeight.bold,color: primarTextColor),
     ),
    ),
   );
}
 MyAppThemeConfig.dark():primarTextColor=Colors.white,
 secondryTextColor=Colors.white70,
 surfaceColor=Color(0x0dffffff),
 backgroundColor=Color.fromARGB(255,30,30,30),
 appBarColor=Colors.black,
 brightness=Brightness.dark;
  MyAppThemeConfig.light():primarTextColor=Colors.grey.shade900,
 secondryTextColor=Colors.grey.shade900.withOpacity(0.8),
 surfaceColor=Color(0x0d000000),
 backgroundColor=Colors.white,
 appBarColor=Colors.red,//.fromARGB(255,235,235,235),
 brightness=Brightness.light;
}
class MyHomePage extends StatefulWidget {
 final Function()toggleThemeMode;
 const MyHomePage({Key?key, required this.toggleThemeMode}):super(key: key);
 @override
 State createState() => _MyHomePageState();
}
enum _Skilltype {
 photoshop,
 xd,
 illustrator,
 afterEffect,
 lightroom,
}
class _MyHomePageState extends State {
 _Skilltype _skill = _Skilltype.photoshop;
 void updateSelectskill(_Skilltype skilltype) {
  setState(() {
   this._skill = skilltype;
  });
 }
 @override
 Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(title: Text("cur vitae"), actions: [
     Icon(CupertinoIcons.chat_bubble),
     Inkwell(
      onTap:widget.toggleThemeMode,
      child: Padding(
       padding: const EdgeInsets.all(8.0),
       child: Icon(CupertinoIcons.ellipsis_vertical),
      ),
     ),
    ]),
    body: SingleChildScrollView(
     physics: BouncingScrollPhysics(),
     child: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
       Padding(
        padding: const EdgeInsets.all(32),
        child: Row(
         children: [
          ClipRRect(
            borderRadius: BorderRadius.circular(22),
            child: Image.asset(
             'images/profile2.png',
             width: 60,
             height: 60,
            )),
          SizedBox(
           width: 16,
          ),
          Expanded(
           child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
             Text(
              'ali gtv',
              style: Theme.of(context).textTheme.subtitle1,
             ),
             SizedBox(
              height: 2,
             ),
             Text('1999'),
             SizedBox(
              height: 4,
             ),
             Row(
              children: [
               Icon(CupertinoIcons.location,
                 size: 15,
                 color: Theme.of(context)
                   .textTheme
                   .bodyText1!
                   .color),
               Text('paris',
                 style: Theme.of(context).textTheme.bodyText1),
              ],
             ),
            ],
           ),
          ),
          Icon(CupertinoIcons.heart),
         ],
        ),
       ),
       Padding(
        padding: const EdgeInsets.fromLTRB(32, 0, 32, 16),
        child: Text(
          'Chapman CBE (born 26 December 1999) is a Scottish former football manager and player, best known for managing Manchester United from ...',
          style: Theme.of(context).textTheme.subtitle1),
       ),
       Divider(),
       Padding(
        padding: const EdgeInsets.fromLTRB(32, 16, 32, 12),
        child: Row(
         crossAxisAlignment: CrossAxisAlignment.center,
         children: [
          Text('skills',
            style: Theme.of(context)
              .textTheme
              .bodyText2!
              .copyWith(fontWeight: FontWeight.w900)),
          SizedBox(
           width: 2,
          ),
          Icon(CupertinoIcons.chevron_down, size: 12),
         ],
        ),
       ),
       SizedBox(
        height: 10,
       ),
       Center(
        child: Wrap(
         direction: Axis.horizontal,
         spacing: 8,
         children: [
          Skill(
           title: 'Photoshop',
           imagepath: 'assets/images/ps.png',
           shadowcolor: Colors.blue,
           isActive: _skill == _Skilltype.photoshop,
           type: _Skilltype.photoshop,
           onTap: () {
            updateSelectskill(_Skilltype.photoshop);
           },
          ),
          Skill(
            title: 'Adobe XD',
            imagepath: 'assets/images/xd.png',
            shadowcolor: Colors.pink,
            isActive: _skill == _Skilltype.xd,
            type: _Skilltype.xd,
            onTap: () {
             updateSelectskill(_Skilltype.xd);
            }),
          Skill(
            title: 'illustrator',
            imagepath: 'assets/images/ai4.png',
            shadowcolor: Colors.orange,
            isActive: _skill == _Skilltype.illustrator,
            type: _Skilltype.illustrator,
            onTap: () {
             updateSelectskill(_Skilltype.illustrator);
            }),
          Skill(
            title: 'After Effect',
            imagepath: 'assets/images/ae.png',
            shadowcolor: Colors.blue.shade800,
            isActive: _skill == _Skilltype.afterEffect,
            type: _Skilltype.afterEffect,
            onTap: () {
             updateSelectskill(_Skilltype.afterEffect);
            }),
          Skill(
            title: 'Lightroom',
            imagepath: 'assets/images/Lr.png',
            shadowcolor: Colors.blue,
            isActive: _skill == _Skilltype.lightroom,
            type: _Skilltype.lightroom,
            onTap: () {
             updateSelectskill(_Skilltype.lightroom);
            }),
         ],
        ),
       ),
       Divider(),
       Padding(
        padding: const EdgeInsets.fromLTRB(32, 16, 32, 12),
        child: Column(
         crossAxisAlignment: CrossAxisAlignment.start,
         children: [
          Text('Personal info',
            style: Theme.of(context)
              .textTheme
              .bodyText2!
              .copyWith(fontWeight: FontWeight.w900)),
          SizedBox(
           height: 12,
          ),
          TextField(
           decoration: InputDecoration(
            labelText: 'Email',
            prefixIcon: Icon(CupertinoIcons.at),
           ),
          ),
          SizedBox(
           height: 8,
          ),
          TextField(
           decoration: InputDecoration(
            labelText: 'Password',
            prefixIcon: Icon(CupertinoIcons.lock),
           ),
          ),
          SizedBox(
           height: 12,
          ),
          SizedBox(
            width: double.infinity,
            height: 50,
            child: ElevatedButton(
              onPressed: () {}, child: Text('Save')))
         ],
        ),
       ),
      ],
     ),
    ));
 }
}
class Skill extends StatelessWidget {
 final _Skilltype type;
 final String title;
 final String imagepath;
 final Color shadowcolor;
 final bool isActive;
 final Function() onTap;
 const Skill({
  Key? key,
  required this.title,
  required this.imagepath,
  required this.shadowcolor,
  required this.isActive,
  required this.type,
  required this.onTap,
 }) : super(key: key);
 @override
 Widget build(BuildContext context) {
  final BorderRadius defaultborderRadius = BorderRadius.circular(12);
  return InkWell(
   borderRadius: defaultborderRadius,
   onTap: onTap,
   child: Container(
    width: 100,
    height: 100,
    decoration: isActive
      ? BoxDecoration(
        color: Color.fromARGB(31, 49, 49, 49),
        borderRadius: defaultborderRadius,
       )
      : null,
    child: Column(
     mainAxisAlignment: MainAxisAlignment.center,
     children: [
      Container(
        decoration: isActive
          ? BoxDecoration(boxShadow: [
            BoxShadow(
              color: shadowcolor.withOpacity(0.5),
              blurRadius: 20),
           ])
          : null,
        child: Image.asset(imagepath, width: 40, height: 40)),
      Text(title),
      const SizedBox(height: 8),
     ],
    ),
   ),
  );
 }
}
Ali Gotvandi ۱۱ تیر ۱۴۰۱، ۱۵:۵۵

سلام. w رو در InkWell باید با حرف بزرگ بنویسید ( Inkwell درست نیست). دومی را درست نوشتید، اما اولی رو باید اصلاح کنید.

Hale Asgari ۲۹ شهریور ۱۴۰۱، ۰۴:۰۲