月下伊人醉

文章 评论 浏览 27

月下伊人醉 2025-02-08 14:11:33

尝试将“类型”更改为“方法”

$('#reference').change(function(){
  var ref = $(this).val();
  $.ajax({
      method: 'POST',
      url: '<?= base_url('/user/getItem')?>',
      data: {
         ref: ref
      },
      dataType: 'JSON',
      success: function(data){
          console.log('anything');
      }
  })
});

Try to change "type" to "method"

$('#reference').change(function(){
  var ref = $(this).val();
  $.ajax({
      method: 'POST',
      url: '<?= base_url('/user/getItem')?>',
      data: {
         ref: ref
      },
      dataType: 'JSON',
      success: function(data){
          console.log('anything');
      }
  })
});

如何使用AJAX从Select2插件中发布数据?

月下伊人醉 2025-02-08 13:02:16

使用Hoare分区方案,枢轴和等于枢轴的元素可以最终到达任何地方,并且在分区步骤p之后,不是枢轴的索引,而是一个分离器,左右值p是&lt; = pivot,p的右侧的值是&gt; = pivot。使用Hoare分区方案,QuickSelect需要递归到1个元素的基本情况,以便找到KTH元素。如果还有其他等于KTH元素的元素,则它们最终可能位于KTH元素的两侧或两侧。

With Hoare partition scheme, the pivot and elements equal to the pivot can end up anywhere, and after a partition step p is not an index to the pivot, but just a separator, values to the left or at p are <= pivot, values to the right of p are >= pivot. With Hoare partition scheme quickselect requires recursing to the the base case of 1 element in order to find the kth element. If there are other elements equal to the kth element, they could end up on either side or both sides of the kth element.

如何从lomuto分区方案转换为QuickSelect/QuickSort中的Hoare分区方案?

月下伊人醉 2025-02-08 08:40:51

假设那是开瓶器选项卡,但我试图获得积极而专注的窗口,但我错了。

此后

chrome.tabs.query({ active: true, lastFocusedWindow: true }, (arrayOfTabs) => {
      if (arrayOfTabs.length > 0 && arrayOfTabs[0].id) {
        chrome.tabs?.reload(arrayOfTabs[0].id, {});
      }
});

chrome.tabs.query({ active: true, windowType: "normal" }, (arrayOfTabs) => {
      if (arrayOfTabs.length > 0 && arrayOfTabs[0].id) {
        chrome.tabs?.reload(arrayOfTabs[0].id, {});
      }
});

这种方式可以获取开启器选项卡。正如@woxxom在评论中提到的那样,无论窗口如何,都标识了标签,这全都与我使用的查询有关。

I was trying to to get the active and focused window assuming that was the opener tab but I has wrong.

Before

chrome.tabs.query({ active: true, lastFocusedWindow: true }, (arrayOfTabs) => {
      if (arrayOfTabs.length > 0 && arrayOfTabs[0].id) {
        chrome.tabs?.reload(arrayOfTabs[0].id, {});
      }
});

After

chrome.tabs.query({ active: true, windowType: "normal" }, (arrayOfTabs) => {
      if (arrayOfTabs.length > 0 && arrayOfTabs[0].id) {
        chrome.tabs?.reload(arrayOfTabs[0].id, {});
      }
});

In this way I can get the opener tab. As @wOxxOm mentioned in a comment, tabs are identified regardless the window, it was all about the query I was using.

Chrome扩展API刷新页面原始窗口中

月下伊人醉 2025-02-07 17:00:37
  • 浮点算术和amp;平等比较很危险:使用//
    (有一个非终止循环的7)
  • 仅除一个启动值时,只要除以两个,
  • 每个参数 s 小于n // 2 ,那里一步是大两倍的两倍:
def ulam(n):
    """ return start, length of the longest sequence starting lower than n. """
    dici = {k: v for k, v in zip(range(n//2, n), range(n//2, n))}
    count = 0
    while dici:  # len(dici)>1):  
        count += 1
        start = next(iter(dici))
        dici = {k:(v//2 if v%2 == 0 else v*3+1) 
                    for k,v in dici.items() if v > 2 }  # > 1 }
        # print(dici, start)
    return start, count

  • floating point arithmetics & comparison for equality is dangerous: use //
    (got a non-ending loop for 7)
  • just dividing by two when just one start value is left may be incorrect
  • For every argument s smaller than n//2, there is one twice as large taking one step more:
    Start with
def ulam(n):
    """ return start, length of the longest sequence starting lower than n. """
    dici = {k: v for k, v in zip(range(n//2, n), range(n//2, n))}
    count = 0
    while dici:  # len(dici)>1):  
        count += 1
        start = next(iter(dici))
        dici = {k:(v//2 if v%2 == 0 else v*3+1) 
                    for k,v in dici.items() if v > 2 }  # > 1 }
        # print(dici, start)
    return start, count

如何更快地使此函数:算法基于偶数和奇数创建链

月下伊人醉 2025-02-07 13:23:13

大约需要7个月,但是如果您仍在寻找答案,不确定它是否最佳,但以下是可行的。

我对您遇到的问题的理解是,“ LateInitializationError”的原因是因为您的Init函数在构造函数中调用是异步调用的,而无需等待其结果。结果,当您在框上调用功能时,初始化尚未完成。当您导航到另一页并返回时,函数init运行恰好完成。因此,错误消失了。这里的复杂性是构造函数无法将其标记为异步,供您使用该等待的关键字。由于您使用的是集团,因此一种可能的解决方法是在Bloc处于Init状态时调用回购的初始化功能。

出于演示目的,我在集合状态和事件下定义了
您绝对可以根据自己的需求更改它们。

// bloc states
abstract class AccountState{}

class InitState extends AccountState{}

class LoadedState extends AccountState{
LoadedState(this.accounts);
final List<Account> accounts;
}

class LoadingErrorState  extends AccountState{}

//bloc events
abstract class AccountEvent {}

class InitEvent extends AccountEvent {}
... // other events

IniteVent上调用repo的init函数

class AccountBloc extends Bloc<AccountEvent, AccountState> {
  AccountBloc(this.repo) : super(InitState()) {
    on<InitEvent>((event, emit) async {
      await repo.init();
      emit(LoadedState(account: repo.getAccounts()));
    });
    ...// define handlers for other events
  }
  final AccountRepository repo;
}

您可以从您的服务类中的

class AccountService {
  late Box<Account> _accounts;
  AccountService();

  Future<void> init() async {
    Hive.registerAdapter(AccountAdapter());
    _accounts = await Hive.openBox<Account>('accounts');
  }
 
  List<Account> getAccounts(){
    return _accounts.values.toList();
  }
}

在您的BLOC逻辑中, 。 :

BlocBuilder<AccountBloc, AccountState>(
builder: (context, state) {
  if (state is InitState) {
    context.read<AccountBloc>.add(InitEvent());
    return const CircularProgressIndicator();
  } else if (state is LoadingErrorState) {
    Future.delayed(Duration.zero, () {
      errorDialog(context, state.error);
    });
  }
  else if (state is LoadedState){
  return SingleChildScrollView(....
  }

此外,仅供参考,如果您希望在实例化帐户服务的对象时调用初始化,则可以查看以下答案:
https://stackoverflow.com/a/59304510/16584569

但是,您仍然需要等待初始化您的服务。一种可能的方法是在您的主要功能中进行操作并传递到您的应用程序,但是它使您的代码结构变得混乱,当您想交换到另一个仓库时,您需要记住在Main功能中更改代码。

It's been like 7 months, but if you are still looking for an answer, not sure if it's optimal but below should work.

My understanding on the issue you are having is that the reason why there is that "LateInitializationError" is because that your init function call in your constructor is asynchronously invoked without await for its result. As a result, there is a possibility that when you are calling functions on the box, the initialisation is not yet finished. When you navigate to another page and go back, the function init run happened to be finished. Hence, the error is gone. The complexity here is that constructor can not be marked as async for you to use that await keyword. Since you are using bloc, one possible workaround is to call the init function of your repo when bloc is in init state.

For demo purpose I defined below bloc states and events,
you can absolutely change them based on your needs.

// bloc states
abstract class AccountState{}

class InitState extends AccountState{}

class LoadedState extends AccountState{
LoadedState(this.accounts);
final List<Account> accounts;
}

class LoadingErrorState  extends AccountState{}

//bloc events
abstract class AccountEvent {}

class InitEvent extends AccountEvent {}
... // other events

in your bloc logic you can call the init function from you repo on InitEvent

class AccountBloc extends Bloc<AccountEvent, AccountState> {
  AccountBloc(this.repo) : super(InitState()) {
    on<InitEvent>((event, emit) async {
      await repo.init();
      emit(LoadedState(account: repo.getAccounts()));
    });
    ...// define handlers for other events
  }
  final AccountRepository repo;
}

in your service class you can remove the init from the constructor like:

class AccountService {
  late Box<Account> _accounts;
  AccountService();

  Future<void> init() async {
    Hive.registerAdapter(AccountAdapter());
    _accounts = await Hive.openBox<Account>('accounts');
  }
 
  List<Account> getAccounts(){
    return _accounts.values.toList();
  }
}

Then in your bloc builder, you can add init event to your bloc when the state is InitState as below:

BlocBuilder<AccountBloc, AccountState>(
builder: (context, state) {
  if (state is InitState) {
    context.read<AccountBloc>.add(InitEvent());
    return const CircularProgressIndicator();
  } else if (state is LoadingErrorState) {
    Future.delayed(Duration.zero, () {
      errorDialog(context, state.error);
    });
  }
  else if (state is LoadedState){
  return SingleChildScrollView(....
  }

Also, FYI, you can if you want the init to be called when the object of your account service is instantiated, you can take a look at below answer:
https://stackoverflow.com/a/59304510/16584569

However, you still going to need to await for the initialisation of your service. One possible way is just do it in your main function and pass down to your app, but it makes the structure of your code messy and when you want to swap to another repo, you need to remember to change code in main function as well.

颤抖的储物库和蜂巢后期化术语

月下伊人醉 2025-02-07 11:27:51

VBA认为字符是一个范围的字符对象。请参阅 targine object(excel)microsoft docs

<代码> dim列(6)作为字符定义一个数组,而不是每个元素中的对象。如果您创建了自己的名为“字符”的类,那么您可以为每个元素做这样的事情

Set columns(0) = New Characters

,但是目前还会产生错误(“对新关键字的使用无效”),

真正的问题是理解一组“角色”在VBA(以及许多其他语言)中称为字符串。
因此,正如@brax指出的那样,您需要将dim列(6)用作字符串。由于字符串内置到VBA中,因此您不需要“初始化”数组中的每个实例。

您的下一个问题是了解VBA和许多其他许多语言中的字符串如何代表。您不能仅仅贴上a,并希望Excel理解您的意思是字母“ A”。在VBA中,我们围绕带有双引号标记的字符串,因此列(0)=“ A”是可以的。

另外,您必须定义变量a eg dim a as string并分配一个值,

例如您的旅程

vba的语言参考

href =“ https://www.homeandlearn.org/index.html” rel =“ nofollow noreferrer”> for完整初学者的Excel VBA编程

VBA thinks that Characters is the Characters object for a range. See Characters object (Excel) Microsoft Docs

Dim columns(6) As Characters defines an array but not the objects in each element. If you had created your own class called Characters then you could do something like this for each element

Set columns(0) = New Characters

But at the moment that will also produce an error ("Invalid use of New keyword")

The real problem is understanding that a set of "characters" is called a String in VBA (and many other languages).
So as @braX has pointed out, you need to use Dim columns(6) As String. Because String is built in to VBA you don't need to "initialise" each instance in the array.

Your next problem is understanding how strings are represented in VBA and many many other languages. You can't just stick an A out there and hope that Excel understands you mean the letter "A". In VBA we surround strings with double-quotation marks so columns(0) = "A" would be ok.

Alternatively you would have to define the Variable A e.g. Dim A as String and assign it a value e.g. A = "A"

Here are a couple of other links to help you on your journey

Language Reference for VBA

Excel VBA Programming for complete beginners

VB-如何初始化字符数组?

月下伊人醉 2025-02-07 09:22:48

我通过将背景添加到每个功能文件来解决此问题。这将在您的功能文件中的每种情况下执行。

例子:

Feature: Doing some this

Background: 
    Given This will run before each scenario
Scenario: 
    Given Will run after the background process
Scenario: 
    This Will also run after the background run

I worked around this by adding background to each feature file. This will execute before each scenario in your feature file.

Example:

Feature: Doing some this

Background: 
    Given This will run before each scenario
Scenario: 
    Given Will run after the background process
Scenario: 
    This Will also run after the background run

如何在柏树测试中实现beforeall黄瓜钩?

月下伊人醉 2025-02-07 04:22:23

您可以使用Apache Commons Stringscapeutils逃脱字符串。例子:

StringEscapeUtils.escapeJavaScript(str);

You can use Apache Commons StringEscapeUtils for escaping the string. Example:

StringEscapeUtils.escapeJavaScript(str);

JavaScript友好的替代品&#x27;角色可用吗?

月下伊人醉 2025-02-07 03:59:56

我会在这里建议3个选项(示例在Java中):

  1. 如果您确切地知道要在fiewport中需要做什么,则可以使用以下内容

    webelement el = driver.findelement(by.xpath(“ xpath”));

    javascriptexecutor js =(Javascriptexecutor)驱动程序;
    js.executescript(“参数[0] .scrollintoview()”,el);

  2. 使用此处提到的SendKeys方法
    webElement el = driver.findelement(by.xpath(“ // body”));
    El.SendKeys(keys.page_down)

  3. 最棘手的选项,查找具有CSS属性'溢出'的元素,其值,其值使滚动条出现在edg溢出:'auto'并使用JavaScript,您将能够确切地知道滚动点并按照任何方向滚动

    webElement el = driver.findelement(by.xpath(“ xpath”));
    Javascriptexecutor JS =(JavasCriptexecutor)驱动程序;
    int scrollamountinpx = 10;
    js.executescript(“参数[0] .scrollto(0,参数[0]。

I would suggest 3 options here (examples are in Java):

  1. If you know exactly element what needs to become in viewport you can use following

    WebElement el = driver.findElement(By.xpath("xpath"));

    JavascriptExecutor js = (JavascriptExecutor) driver;
    js.executeScript("arguments[0].scrollIntoView()",el);

  2. Use sendKeys method mentioned here already
    WebElement el = driver.findElement(By.xpath("//body"));
    el.sendKeys(Keys.PAGE_DOWN)

  3. The most tricky option, find element which has css property 'overflow' with value that makes scroll bar to appear e.g. overflow: 'auto' and using JavaScript you will be able to know exactly scrolling point and scroll in any direction as you like

    WebElement el = driver.findElement(By.xpath("xpath"));
    JavascriptExecutor js = (JavascriptExecutor) driver;
    int scrollAmountInPx = 10;
    js.executeScript("arguments[0].scrollTo(0, arguments[0].scrollTop + " + scrollAmountInPx+ ")",el);

如何找到滚动条/按钮的XPATH?

月下伊人醉 2025-02-06 15:16:06

我解决了问题如下,这不是完美的,但是...

我也把处理程序放入了类组件

componentDidMount() {
    if (window.addEventListener) {            
        window.addEventListener('beforeunload', this.onUnloadPage);
    } else {            
        window.attachEvent('onbeforeunload', this.onUnloadPage);
    }
}

componentWillUnmount() {
    if (window.addEventListener) {
        window.removeEventListener('beforeunload', this.onUnloadPage);
    } else {
        window.detachEvent('onbeforeunload', this.onUnloadPage);
    }
}

onUnloadPage = (event) => {
    window.setTimeout(function () {
        window.location = '/collections/';
    }, 0);
    window.onbeforeunload = null;
};

I solved the problem as follows, it's not perfect but...

also I put the handler in a class component

componentDidMount() {
    if (window.addEventListener) {            
        window.addEventListener('beforeunload', this.onUnloadPage);
    } else {            
        window.attachEvent('onbeforeunload', this.onUnloadPage);
    }
}

componentWillUnmount() {
    if (window.addEventListener) {
        window.removeEventListener('beforeunload', this.onUnloadPage);
    } else {
        window.detachEvent('onbeforeunload', this.onUnloadPage);
    }
}

onUnloadPage = (event) => {
    window.setTimeout(function () {
        window.location = '/collections/';
    }, 0);
    window.onbeforeunload = null;
};

如果用户在函数组件中刷新(使用F5),则反应如何重定向到页面

月下伊人醉 2025-02-06 14:59:41

这就是我实施它的方式。
我还检查了向后没有序列,例如(4321,DCBA)。

private fun noSequenzes(password: String) : Boolean {
    val charRuns = listOf(
        '0'..'9',
        'a'..'z',
        'A'..'Z',
        "qwertzuiop".asIterable(),
        "asdfghjklöä".asIterable(),
        "yxcvbnm".asIterable()
    )
    var map = emptyMap<Char, MutableSet<Char?>>()
    charRuns.forEach { run ->
        run.forEach { char ->
            val charsToAdd = mutableSetOf(run.elementAtOrNull(run.indexOf(char) + 1))
            if (run is CharRange) {
                charsToAdd.add(run.elementAtOrNull(run.indexOf(char) - 1))
            }
            if (map.contains(char)) {
                map.get(char)!!.addAll(charsToAdd)
            }
            else {
                map = map.plus(Pair(char, charsToAdd))
            }
        }
    }
    var sequenceCounter = 1
    var recentChar: Char? = null
    password.toCharArray().forEach { c ->
        recentChar?.let { rc ->
            val isSequence = map.any { me -> me.key == rc && me.value.contains(c) }
            if (isSequence) {
                sequenceCounter = sequenceCounter + 1
            }
            else {
                sequenceCounter = 1
            }
            if (sequenceCounter >= 3) {
                return false
            }
        }
        recentChar = c
    }
    return true
}

This is how I implemented it.
I also check that there is no sequence in backwards, for example (4321, dcba).

private fun noSequenzes(password: String) : Boolean {
    val charRuns = listOf(
        '0'..'9',
        'a'..'z',
        'A'..'Z',
        "qwertzuiop".asIterable(),
        "asdfghjklöä".asIterable(),
        "yxcvbnm".asIterable()
    )
    var map = emptyMap<Char, MutableSet<Char?>>()
    charRuns.forEach { run ->
        run.forEach { char ->
            val charsToAdd = mutableSetOf(run.elementAtOrNull(run.indexOf(char) + 1))
            if (run is CharRange) {
                charsToAdd.add(run.elementAtOrNull(run.indexOf(char) - 1))
            }
            if (map.contains(char)) {
                map.get(char)!!.addAll(charsToAdd)
            }
            else {
                map = map.plus(Pair(char, charsToAdd))
            }
        }
    }
    var sequenceCounter = 1
    var recentChar: Char? = null
    password.toCharArray().forEach { c ->
        recentChar?.let { rc ->
            val isSequence = map.any { me -> me.key == rc && me.value.contains(c) }
            if (isSequence) {
                sequenceCounter = sequenceCounter + 1
            }
            else {
                sequenceCounter = 1
            }
            if (sequenceCounter >= 3) {
                return false
            }
        }
        recentChar = c
    }
    return true
}

密码验证无字符序列(Kotlin Android Studio)

月下伊人醉 2025-02-06 10:26:45

首先通过迁移文件更新当前记录。您已经创建了会标字段。

学说创建一个新的迁移文件:迁移:生成。这将位于/migrations/versionxxxxxxxxxxxxxxxx.php

编辑迁移文件,因此是这样的:

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class VersionXXXXXXXXXXXXXX extends AbstractMigration
{
    public function getDescription(): string
    {
        return '';
    }

    public function up(Schema $schema): void
    {
        foreach ($this->connection->fetchAll('SELECT id, name FROM user') as $user) {
            $this->addSql(
                'UPDATE user SET monogram = :monogram_field WHERE id = :user_id',
                array(
                    'monogram_field' => $this->generateInitials($user['name']),
                    'user_id' => $user['id']
                )
            );
        }
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs

    }

    private function generateInitials(?string $string): ?string
    {
        if (null === $string || empty($string)) return null;
        
        // Regex to match first letter of each word
        preg_match_all('/(?<=\b)[a-z]/i', $string, $matches);

        return strtoupper(implode('', $matches[0]));
    }
}

您可以运行学说:迁移:迁移迁移:execute -up'doctrinemigrations \ doctrinemigrations \ dodyxxxxxxxxxxxxxxxxxxx'代码>运行它。

现在,对于将来的插入,请更新您的用户实体以包含以下功能:

/**
 * Gets triggered only on insert
 * @ORM\PrePersist
 */
public function onPrePersist()
{
    $this->monogram = $this->generateInitials($this->name);
}

private function generateInitials(?string $string): ?string
{
    if (null === $string || empty($string)) return null;

    // Regex to match first letter of each word
    preg_match_all('/(?<=\b)[a-z]/i', $string, $matches);

    return strtoupper(implode('', $matches[0]));
}

记住添加@orm \ haslifecyclecallbacks在类的顶部。插入新用户时,它将填充会标字段。

我还没有完全测试过。首先在虚拟数据上进行本地测试,并根据您认为合适的方式进行调整。

First update current records via a migration file. You have already created the monogram field.

Create a new migration file with doctrine:migrations:generate. This will be located /migrations/VersionXXXXXXXXXXXXXX.php.

Edit your migration file, so it is like this:

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class VersionXXXXXXXXXXXXXX extends AbstractMigration
{
    public function getDescription(): string
    {
        return '';
    }

    public function up(Schema $schema): void
    {
        foreach ($this->connection->fetchAll('SELECT id, name FROM user') as $user) {
            $this->addSql(
                'UPDATE user SET monogram = :monogram_field WHERE id = :user_id',
                array(
                    'monogram_field' => $this->generateInitials($user['name']),
                    'user_id' => $user['id']
                )
            );
        }
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs

    }

    private function generateInitials(?string $string): ?string
    {
        if (null === $string || empty($string)) return null;
        
        // Regex to match first letter of each word
        preg_match_all('/(?<=\b)[a-z]/i', $string, $matches);

        return strtoupper(implode('', $matches[0]));
    }
}

You can run doctrine:migrations:migrate or migrations:execute --up 'DoctrineMigrations\VersionXXXXXXXXXXXXXX' to run it.

Now for future insertions, update your User entity to include these functions:

/**
 * Gets triggered only on insert
 * @ORM\PrePersist
 */
public function onPrePersist()
{
    $this->monogram = $this->generateInitials($this->name);
}

private function generateInitials(?string $string): ?string
{
    if (null === $string || empty($string)) return null;

    // Regex to match first letter of each word
    preg_match_all('/(?<=\b)[a-z]/i', $string, $matches);

    return strtoupper(implode('', $matches[0]));
}

Remember to add @ORM\HasLifecycleCallbacks to the top of the class. When a new User is inserted it will populate the monogram field.

I haven't fully tested this. Test it locally first on dummy data and tweak as you see fit.

在Symfony中,您如何填充具有与现有列值相关的值的新列?

月下伊人醉 2025-02-06 06:49:23

您可以使用highCharts.svgrenderer渲染三角形。

API参考:
https://api.highcharts.com/class-class-reference-class-reference/highcharts.svgrenderer

但我认为最简单的选择将是使用带有三角形标记的散点系列来实现这一目标。检查以下配置和演示:

{
  type: 'scatter',
  showInLegend: false,
  enableMouseTracking: false,
  marker: {
    symbol: 'triangle-down',
    fillColor: 'rgb(124, 181, 236)',
    radius: 9
  },
  states: {
    inactive: {
      opacity: 1,
    },
  },
  data: [{
      x: 9,
      y: -1.3
    },
    {
      x: 10,
      y: -8.7
    },
    {
      x: 11,
      y: -9.0
    }
  ]
}

演示:

You can render triangles by using Highcharts.SVGRenderer.

API Reference:
https://api.highcharts.com/class-reference/Highcharts.SVGRenderer

But I think the easiest option will be using a scatter series with triangle markers to achive this. Check the following config and demo:

{
  type: 'scatter',
  showInLegend: false,
  enableMouseTracking: false,
  marker: {
    symbol: 'triangle-down',
    fillColor: 'rgb(124, 181, 236)',
    radius: 9
  },
  states: {
    inactive: {
      opacity: 1,
    },
  },
  data: [{
      x: 9,
      y: -1.3
    },
    {
      x: 10,
      y: -8.7
    },
    {
      x: 11,
      y: -9.0
    }
  ]
}

Demo:
https://jsfiddle.net/BlackLabel/3rokf4aw/

HighChart-列范围作为箭头

月下伊人醉 2025-02-05 14:49:24

提供商类型为networkStatus?,但是尝试通过networkStatus进行。

StreamProvider<NetworkStatus?>(
  initialData: null,
  create: (context) => NetworkStatusService().networkStatusController.stream,
)

...

NetworkStatus? networkStatus = Provider.of<NetworkStatus?>(context);

Provider type is NetworkStatus?, but the attempt is made on NetworkStatus.

StreamProvider<NetworkStatus?>(
  initialData: null,
  create: (context) => NetworkStatusService().networkStatusController.stream,
)

...

NetworkStatus? networkStatus = Provider.of<NetworkStatus?>(context);

Flutter流提供商无法找到正确的提供商RROR

月下伊人醉 2025-02-05 01:43:37

您可以为按下和选择状态添加选择器,而不是集中的状态

<?xml version="1.0" encoding="utf-8"?>
<selector 
   xmlns:android="http://schemas.android.com/apk/res/android">
   <item android:state_window_focused="false" 
     android:state_enabled="true"
     android:drawable="@drawable/ic_email" />
   <item android:state_window_focused="false" 
     android:state_enabled="false"
     android:drawable="@drawable/ic_email" />
   <item android:state_pressed="true" 
     android:drawable="@drawable/ic_email_focused" />
   <item android:state_enabled="true" 
     android:state_focused="true" 
     android:drawable="@drawable/ic_email_focused" />
   <item android:state_enabled="true" 
     android:drawable="@drawable/ic_email" />
   <item android:state_focused="true" 
     android:drawable="@drawable/ic_email_focused" />
   <item android:drawable="@drawable/ic_email" />
</selector>

Instead of a focused state, you can add a selector for a pressed and selected state like following

<?xml version="1.0" encoding="utf-8"?>
<selector 
   xmlns:android="http://schemas.android.com/apk/res/android">
   <item android:state_window_focused="false" 
     android:state_enabled="true"
     android:drawable="@drawable/ic_email" />
   <item android:state_window_focused="false" 
     android:state_enabled="false"
     android:drawable="@drawable/ic_email" />
   <item android:state_pressed="true" 
     android:drawable="@drawable/ic_email_focused" />
   <item android:state_enabled="true" 
     android:state_focused="true" 
     android:drawable="@drawable/ic_email_focused" />
   <item android:state_enabled="true" 
     android:drawable="@drawable/ic_email" />
   <item android:state_focused="true" 
     android:drawable="@drawable/ic_email_focused" />
   <item android:drawable="@drawable/ic_email" />
</selector>

Android Studio自定义图标state_focused noting not

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文