CopyPastor

Detecting plagiarism made easy.

Score: 1; Reported for: String similarity Open both answers

Possible Plagiarism

Reposted on 2023-08-06
by Syed Arsalan Kazmi

Original Post

Original - Posted on 2023-08-06
by Syed Arsalan Kazmi



            
Present in both answers; Present only in the new answer; Present only in the old answer;

import 'dart:async'; import 'dart:math'; import 'package:flutter/material.dart'; class AnimatedBackground extends StatefulWidget { const AnimatedBackground({super.key}); @override _AnimatedBackgroundState createState() => _AnimatedBackgroundState(); } class _AnimatedBackgroundState extends State<AnimatedBackground> { late Timer _timer; final List<Color> _colors = [ const Color(0xFFFF0000), // Red const Color(0xFFFF7F00), // Orange const Color(0xFFFFFF00), // Yellow const Color(0xFF00FF00), // Green const Color(0xFF0000FF), // Blue const Color(0xFF4B0082), // Indigo const Color(0xFF9400D3), // Violet ]; double _animationValue = 0.0; @override void initState() { super.initState(); _timer = Timer.periodic(const Duration(milliseconds: 40), (timer) { setState(() { _animationValue = (sin(timer.tick / 60) + 1) / 2; // Adjust the factor for the speed and smoothness }); }); } @override void dispose() { _timer.cancel(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Container( width: 200, height: 200, decoration: BoxDecoration( border: Border.all( color: Colors.black, width: 2, ), borderRadius: const BorderRadius.all(Radius.circular(10)), gradient: SweepGradient( startAngle: 0.0, endAngle: 2 * pi, colors: [ _interpolateColor(_animationValue), _interpolateColor((_animationValue + 0.1) % 1.0), ], ), ), ), ), ); } Color _interpolateColor(double t) { final index1 = (t * (_colors.length - 1)).floor(); final index2 = (index1 + 1) % _colors.length; final color1 = _colors[index1]; final color2 = _colors[index2]; final factor = t * (_colors.length - 1) - index1; return Color.lerp(color1, color2, factor)!; } }

import 'dart:async'; import 'dart:math'; import 'package:flutter/material.dart'; class AnimatedBackground extends StatefulWidget { const AnimatedBackground({super.key}); @override _AnimatedBackgroundState createState() => _AnimatedBackgroundState(); } class _AnimatedBackgroundState extends State<AnimatedBackground> { late Timer _timer; final List<Color> _colors = [ const Color(0xFFFF0000), // Red const Color(0xFFFF7F00), // Orange const Color(0xFFFFFF00), // Yellow const Color(0xFF00FF00), // Green const Color(0xFF0000FF), // Blue const Color(0xFF4B0082), // Indigo const Color(0xFF9400D3), // Violet ]; double _animationValue = 0.0; @override void initState() { super.initState(); _timer = Timer.periodic(const Duration(milliseconds: 40), (timer) { setState(() { _animationValue = (sin(timer.tick / 60) + 1) / 2; // Adjust the factor for the speed and smoothness }); }); } @override void dispose() { _timer.cancel(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Container( width: 200, height: 200, decoration: BoxDecoration( border: Border.all( color: Colors.black, width: 2, ), borderRadius: const BorderRadius.all(Radius.circular(10)), gradient: SweepGradient( startAngle: 0.0, endAngle: 2 * pi, colors: [ _interpolateColor(_animationValue), _interpolateColor((_animationValue + 0.1) % 1.0), ], ), ), ), ), ); } Color _interpolateColor(double t) { final index1 = (t * (_colors.length - 1)).floor(); final index2 = (index1 + 1) % _colors.length; final color1 = _colors[index1]; final color2 = _colors[index2]; final factor = t * (_colors.length - 1) - index1; return Color.lerp(color1, color2, factor)!; } }


        
Present in both answers; Present only in the new answer; Present only in the old answer;