Visual Studio Code nasıl sıfırlanabilir?

Emre333333

Hectopat
Katılım
28 Haziran 2022
Mesajlar
169
Visual Studio Code üzerinde kod yazıyordum. Yanlışlıkla bir şey yaptım ve önceden yazdıklarım da dahil tüm kodlarındaki image kodu çalışmamaya başladı. Mesela yürüyemeden kurs izlerken hoca zar atma uygulaması yaptırmıştı. İçinde de 6 tane zar resmi vardı ve gayet iyi çalışıyordu kod. Şimdi kottaki image şeyine hata veriyor (undefined name 'ımage')

Visual Studio Code üzerinde kod yazıyordum. Yanlışlıkla bir şey yaptım ve önceden yazdıklarım da dahil tüm kodlarındaki image kodu çalışmamaya başladı. Mesela yürüyemeden kurs izlerken hoca zar atma uygulaması yaptırmıştı. İçinde de 6 tane zar resmi vardı ve gayet iyi çalışıyordu kod. Şimdi kottaki image şeyine hata veriyor (undefined name 'ımage')

Şu duruma bir türlü çözüm bulamadım onun için sıfırlamak silmek ne yapabilirsem işte iyi olacak şekilde yapmaya çalışıyorum. Nasıl yapabilirim?
 
Hangi dili kullanıyorsun?
Muhtemelen kodlarında bir sorun vardır, kodları paylaşabilirsen yardımcı olmak isterim.
 
Hangi dili kullanıyorsun?
Muhtemelen kodlarında bir sorun vardır, kodları paylaşabilirsen yardımcı olmak isterim.
Flutter (dart) zar kodu böyle . 3 sayfa daha var ama onlarda hatada vermiyor zaten.import 'package:flutter/material.dart';
import 'dart:math';

final randomizer = Random();
class DiceRoller extends StatefulWidget{
DiceRoller({super.key});
@override
State<DiceRoller> createState() {
return _DiceRollerState();
}
}



class _DiceRollerState extends State<DiceRoller>{
var currentDiceRoll = 2;

var activeDiceImage ='assets/images/dice-2.png' ;
void rollDice() {
var diceRoll = Random().nextInt(6) +1;
setState(() {
currentDiceRoll = diceRoll ;
});
activeDiceImage = 'assets/images/dice-$currentDiceRoll.png';
}

Widget build(context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset( activeDiceImage ,
width: 200,
),
SizedBox(height: 40,),
TextButton(
onPressed: rollDice,
style: TextButton.styleFrom(
foregroundColor: const Color.fromARGB(255, 195, 12, 12),textStyle:const TextStyle(fontSize: 28),backgroundColor: Colors.blueGrey),
child: const Text('ROLL DİCE'),)
],
);
}
}
Bu kod sabah ne yaptım bilmiyorum ama önceden calisiyordu

Flutter (dart) zar kodu böyle. 3 sayfa daha var ama onlarda hatada vermiyor zaten. İmport 'package:flutter/material.dart';
İmport 'dart: Math';

Final randomizer = Random();
Class DiceRoller extends StatefulWidget{
DiceRoller({super. Key});
@Override
State<DiceRoller> createState() {
Return _DiceRollerState();
}
}

Class _DiceRollerState extends State<DiceRoller>{
Var currentDiceRoll = 2;

Var activeDiceImage ='assets/images/dice-2.png';
Void rollDice() {
Var diceRoll = Random().nextInt(6) +1;
setState(() {
CurrentDiceRoll = diceRoll;
});
ActiveDiceImage = 'assets/images/dice-$currentDiceRoll.png';
}

Widget Build(context) {
Return Column(
MainAxisSize: MainAxisSize. Min,
Children: [
Image.asset( activeDiceImage ,
width: 200,
),
SizedBox(height: 40,),
TextButton(
onPressed: rollDice,
style: TextButton.styleFrom(
foregroundColor: const Color.fromARGB(255, 195, 12, 12),textStyle:const TextStyle(fontSize: 28),backgroundColor: Colors.blueGrey),
child: const Text('ROLL DİCE'),)
],
);
}
}
Bu kod sabah ne yaptım bilmiyorum ama önceden calisiyordu.

Sabah terminalde bir yazıyı kodumun izine sürükledim gibi oldu sonra CTRL Z yaptım bu hata ondan beri var.
 
assets klasörü altında olan resimlerin doğru konumda olduklarını ve bu konumların pubspec. Yaml dosyanda doğru bir şekilde tanımlanıp tanımlanmadığını bir kontrol eder misin?

DiceRoller kodların:

JavaScript:
import 'package:flutter/material.dart';
import 'dart:math';

final randomizer = Random();

class DiceRoller extends StatefulWidget {
 DiceRoller({super.key});

 @override
 State<DiceRoller> createState() {
 return _DiceRollerState();
 }
}

class _DiceRollerState extends State<DiceRoller> {
 var currentDiceRoll = 2;
 var activeDiceImage = 'assets/images/dice-2.png';

 void rollDice() {
 var diceRoll = Random().nextInt(6) + 1;
 setState(() {
 currentDiceRoll = diceRoll;
 activeDiceImage = 'assets/images/dice-$currentDiceRoll.png';
 });
 }

 @override
 Widget build(BuildContext context) {
 return Column(
 mainAxisSize: MainAxisSize.min,
 children: [
 Image.asset(
 activeDiceImage,
 width: 200,
 ),
 SizedBox(height: 40),
 TextButton(
 onPressed: rollDice,
 style: TextButton.styleFrom(
 foregroundColor: const Color.fromARGB(255, 195, 12, 12),
 textStyle: const TextStyle(fontSize: 28),
 backgroundColor: Colors.blueGrey,
 ),
 child: const Text('ROLL DICE'),
 ),
 ],
 );
 }
}

pubspec. Yaml ı da bu şekilde düzenler misin?

YAML:
flutter:
 assets:
 - assets/images/dice-1.png
 - assets/images/dice-2.png
 - assets/images/dice-3.png
 - assets/images/dice-4.png
 - assets/images/dice-5.png
 - assets/images/dice-6.png

assets klasörü altında olan resimlerin doğru konumda olduklarını ve bu konumların pubspec. Yaml dosyanda doğru bir şekilde tanımlanıp tanımlanmadığını bir kontrol eder misin?

DiceRoller kodların:

JavaScript:
import 'package:flutter/material.dart';
import 'dart:math';

final randomizer = Random();

class DiceRoller extends StatefulWidget {
 DiceRoller({super.key});

 @override
 State<DiceRoller> createState() {
 return _DiceRollerState();
 }
}

class _DiceRollerState extends State<DiceRoller> {
 var currentDiceRoll = 2;
 var activeDiceImage = 'assets/images/dice-2.png';

 void rollDice() {
 var diceRoll = Random().nextInt(6) + 1;
 setState(() {
 currentDiceRoll = diceRoll;
 activeDiceImage = 'assets/images/dice-$currentDiceRoll.png';
 });
 }

 @override
 Widget build(BuildContext context) {
 return Column(
 mainAxisSize: MainAxisSize.min,
 children: [
 Image.asset(
 activeDiceImage,
 width: 200,
 ),
 SizedBox(height: 40),
 TextButton(
 onPressed: rollDice,
 style: TextButton.styleFrom(
 foregroundColor: const Color.fromARGB(255, 195, 12, 12),
 textStyle: const TextStyle(fontSize: 28),
 backgroundColor: Colors.blueGrey,
 ),
 child: const Text('ROLL DICE'),
 ),
 ],
 );
 }
}

pubspec. Yaml ı da bu şekilde düzenler misin?

YAML:
flutter:
 assets:
 - assets/images/dice-1.png
 - assets/images/dice-2.png
 - assets/images/dice-3.png
 - assets/images/dice-4.png
 - assets/images/dice-5.png
 - assets/images/dice-6.png

Bu yanıtı verirken chatGPT'nin gücünden de faydalandım.
 
assets klasörü altında olan resimlerin doğru konumda olduklarını ve bu konumların pubspec. Yaml dosyanda doğru bir şekilde tanımlanıp tanımlanmadığını bir kontrol eder misin?

DiceRoller kodların:

JavaScript:
import 'package:flutter/material.dart';
import 'dart:math';

final randomizer = Random();

class DiceRoller extends StatefulWidget {
 DiceRoller({super.key});

 @override
 State<DiceRoller> createState() {
 return _DiceRollerState();
 }
}

class _DiceRollerState extends State<DiceRoller> {
 var currentDiceRoll = 2;
 var activeDiceImage = 'assets/images/dice-2.png';

 void rollDice() {
 var diceRoll = Random().nextInt(6) + 1;
 setState(() {
 currentDiceRoll = diceRoll;
 activeDiceImage = 'assets/images/dice-$currentDiceRoll.png';
 });
 }

 @override
 Widget build(BuildContext context) {
 return Column(
 mainAxisSize: MainAxisSize.min,
 children: [
 Image.asset(
 activeDiceImage,
 width: 200,
 ),
 SizedBox(height: 40),
 TextButton(
 onPressed: rollDice,
 style: TextButton.styleFrom(
 foregroundColor: const Color.fromARGB(255, 195, 12, 12),
 textStyle: const TextStyle(fontSize: 28),
 backgroundColor: Colors.blueGrey,
 ),
 child: const Text('ROLL DICE'),
 ),
 ],
 );
 }
}

pubspec. Yaml ı da bu şekilde düzenler misin?

YAML:
flutter:
 assets:
 - assets/images/dice-1.png
 - assets/images/dice-2.png
 - assets/images/dice-3.png
 - assets/images/dice-4.png
 - assets/images/dice-5.png
 - assets/images/dice-6.png



Bu yanıtı verirken chatGPT'nin gücünden de faydalandım.
Doğru yerdeler fotolarda sıkıntı yok
 

Technopat Haberler

Geri
Yukarı